Introduced in the 1977 ANSI M[UMPS] language standard.

This function returns a code that describes the existence of descendants and values of variables.

Assume that the following elements of `Y` are defined:

`Y(0)=0
Y(1)=1
Y(2)=2
Y(1,2,3)=123`

Then the function **$DATA** will return the following
results:

`Y(0)` has a value and no elements exist with indices like
(0,...):

Reference | Value | |
---|---|---|

$DATA(Y(0)) |
1 |

`Y(1)` has a value and at least one element exists with
indices like (1,...), viz. `Y(1,2,3)`:

Reference | Value | |
---|---|---|

$DATA(Y(1)) |
11 |

`Y(2)` has a value and no elements exist with indices like
(2,...):

Reference | Value | |
---|---|---|

$DATA(Y(2)) |
1 |

`Y(1,2)` has no value, but at least one element exists
with indices like (1,2,...), viz. `Y(1,2,3)`:

Reference | Value | |
---|---|---|

$DATA(Y(1,2)) |
10 |

`Y(1,2,3)` has a value and no elements exist with indices
like (1,2,3,...):

Reference | Value | |
---|---|---|

$DATA(Y(1,2,3)) |
1 |

Assume that no local variables exist and that each new example (except for the last) adds a new element to the set.

Reference | Value | |
---|---|---|

Conditions: | Function-values: | |

Y not defined |
$DATA(Y)=0 | |

SET Y=100 |
$DATA(Y)=1 | |

SET Y="AB" |
$DATA(Y)=1 | |

SET A(1)="ABC" |
$DATA(A(1))=1 | |

$DATA(A)=10 | ||

SET B(1,2)="BC" |
$DATA(B(1,2))=1 | |

$DATA(B(1))=10 | ||

$DATA(B))=10 | ||

SET B(1)="CD" |
$DATA(B(1))=11 | |

KILL B(1,2) |
$DATA(B(1,2))=0 | |

$DATA(B(1))=1 | ||

$DATA(B)=10 |

**$DATA** with a global variable as the parameter:

**KILL** ^A **SET** ^A(1,2,3)="Value"

Examples with naked references:

Command | Value ofX |
Value of thenaked indicator |
---|---|---|

SET X=$DATA(^A) |
10 |
not defined |

SET X=$DATA(^(1)) |
error | not defined |

SET X=$DATA(^A(1)) |
10 |
"^A(" |

SET X=$DATA(^A(99)) |
0 |
"^A(" |

SET X=$DATA(^A(1)) |
10 |
"^A(" |

SET X=$DATA(^(1,2)) |
10 |
"^A(1," |

SET X=$DATA(^(2)) |
10 |
"^A(1," |

SET X=$DATA(^(2,3)) |
1 |
"^A(1,2," |

SET X=$DATA(^3)) |
1 |
"^A(1,2," |

SET X=$DATA(^(4)) |
0 |
"^A(1,2," |

SET X=$DATA(^A(1,2)) |
10 |
"^A(1," |

SET ^A(1,2,3,4)="" |
"^A(1,2,3," | |

SET X=$DATA(^A(1,2,3)) |
11 |
"^A(1,2," |

**$DATA**(GLVN)

**SET** ^ABC(1,2)="reset naked indicator"

; Naked indicator is now `^ABC(1,
SET ^(3,4)=$DATA(^(5,6))`

; 1. fetch ^(5,6) =

; 2. store ^(3,4) =

; Naked indicator is now:

This document is © Ed de Moel, 1995-2005.

It is part of a book by Ed de Moel that is published under
the title "M[UMPS] by Example" (ISBN 0-918118-42-5).

Printed copies of the book are no longer available.