Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples

$DATA

M[UMPS] by Example

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 of
X
Value of the
naked 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) = ^ABC(1,5,6)
; 2. store ^(3,4) = ^ABC(1,5,3,4)
; naked indicator is now: ^ABC(1,5,3,

Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples

Copyright © Standard Documents; 1977-2024 MUMPS Development Committee;
Copyright © Examples: 1995-2024 Ed de Moel;
Copyright © Annotations: 2003-2008 Jacquard Systems Research
Copyright © Annotations: 2008-2024 Ed de Moel.

The information in this page is NOT authoritative and subject to be modified at any moment.
Please consult the appropriate (draft) language standard for an authoritative definition.

Some specifications are "approved for inclusion in a future standard". Note that the MUMPS Development Committee cannot guarantee that such future standards will indeed be published.

This page most recently updated on 14-Nov-2023, 21:30:56.

For comments, contact Ed de Moel (demoel@jacquardsystems.com)