Approved for inclusion in a future ANSI 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,"""" -->"^ABC(1,2,3)" 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.
... DO SAVNAK ... DO RESTNAK ... QUIT 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 ^(3)="data ^A 3 (must be retrieved later)"
SET SBE="$REFERENCE should be equal to "
WRITE !,SBE,"'^A(3)': ",V1
WRITE !,SBE,"'^A(3,4)': ",V2
WRITE !,SBE,"'^A(3,4)': ",V3
WRITE !,"Naked reference should work: ",^(3)
SET ^X=1 WRITE !,$REFERENCE
SET ^X(1)=2 WRITE !,$REFERENCE
WRITE !,"Naked indicator is undefined."
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"")." QUIT Test1 NEW $REFERENCE DO Test2 QUIT Test2 ; Re-define $REFERENCE IF $DATA(^Other("Name")) QUIT
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.
This document describes the various special variables that are defined in the M[UMPS] language standard (ANSI X11.1, ISO 11756).
The information in this document is NOT authoritative
and subject to be modified at any moment.
Please consult the appropriate (draft) language standard for an authoritative definition.
In this document, information is included that will
The MDC cannot guarantee that these 'next' standards will indeed appear.