Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples
Left Hand Pointer


M[UMPS] by Example

Right Hand Pointer

Approved for inclusion in a future M[UMPS] language standard.

The value of this variable is equal to the name of the global variable that defined the current value of the "naked indicator" (or is empty when the "naked indicator" is currently undefined).

NAKED() ; Get naked indicator
 IF $Reference="" Quit "<undefined>"
 New TMP
 Set TMP=$Data(^(0))
 Set TMP=$Reference
 Quit $Extract(TMP,1,$Length(TMP)–2)

Kill ^ABC
Set ^ABC(1,2,3)="Demo"
Write "-->""",$Reference,""""
Set A=$Query(^ABC(1))
Write "-->""",A,""", and """,$Reference,"""."
-->"^ABC(1,2,3)", and "".

After a reference to the function $Query, the naked indicator becomes undefined, which means that $Reference becomes equal to the empty string.

SAVNAK Set OLD=$Reference Quit
RESTNAK Set $Reference=OLD Quit

could be used to save and restore the naked indicator. Note that Setting $Reference does not imply that the global variable that it points to is actually referenced, only that the naked indicator is (re)set.

Set X=$Data(^A(3))
Set ^(3)="data ^A 3 (must be retrieved later)"
Set SBE="$REFERENCE should be equal to "
Set V1=$Reference
Write !,SBE,"'^A(3)': ",V1
Set X=$Data(^(3,4))
Set V2=$Reference
Write !,SBE,"'^A(3,4)': ",V2
Lock ^P(27)
Set V3=$Reference
Write !,SBE,"'^A(3,4)': ",V3
Set $Reference=V1
Write !,"Naked reference should work: ",^(3)
Write !

Set ^X=1 Write !,$Reference
Set ^X(1)=2 Write !,$Reference
Set $Reference=""
Write !,"naked indicator is undefined."

should produce:

Note that a reference to ^X makes the naked indicator undefined, but does not make $Reference empty.
The final command, Set $Reference="" makes $Reference empty and also makes the naked indicator undefined.

$Reference may occur as an argument of a New command.

        ; Define value of $REFERENCE
        If $Data(^Test(1234)
        Do Test1
        Write !,"The value of $REFERENCE is "
        Write $Reference
        Write !,"This value should be ^Test(1234)."
        Do Test2
        Write !,"The value of $REFERENCE is "
        Write $Reference
        Write !,"Should be ^Other(""Name"")."
Test1   New $Reference
        Do Test2
Test2   ; Re-define $REFERENCE
        If $Data(^Other("Name"))
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-2017 MUMPS Development Committee;
Copyright © Examples: 1995-2017 Ed de Moel;
Copyright © Annotations: 2003-2017 Jacquard Systems Research.

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 29-Nov-2011, 21:15:25 .

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