Structured System variables -- ^$Y...

^$Y[...], User Defined Structured System Variables

Approved addition for a future M[UMPS] Language Standard.

Users may add definitions to their systems that enable them to create their own structured system variables.

The implementation will provide a means to associate the name of a routine with the name of a user defined structured system variable. Within such a routine, the following labels are defined to have a specific meaning.

SET MyVar=$NAME(^$YMine(1,2,"ABC",4,5))

The following examples assume that the value of local variable MyVar is equal to the name value of a user defined structured system variable.

The function $$%VALUE(MyVar) is invoked to obtain the value of a user defined structured system variable.

The function $$%DATA(MyVar) is invoked when a user defined structured system variable appears as a parameter of the intrinsic function $DATA.

The functions $$%GET(MyVar) and $$%GET(MyVar,default) are invoked when a user defined structured system variable appears as the first parameter of the intrinsic function $GET.

The functions $$%ORDER(MyVar) and $$%ORDER(MyVar,direction) are invoked when a user defined structured system variable appears as the first parameter of the intrinsic function $ORDER.

The functions $$%QUERY(MyVar) and $$%QUERY(MyVar,direction) are invoked when a user defined structured system variable appears as the first parameter of the intrinsic function QUERY.

The subroutine %KILL(MyVar) is invoked when a user defined structured system variable appears as an argument of the KILL command.

The subroutine %KSUBSCRIPTS(MyVar) is invoked when a user defined structured system variable appears as an argument of the KSUBSCRIPTS command.

The subroutine %KVALUE(MyVar) is invoked when a user defined structured system variable appears as an argument of the KVALUE command.

The subroutine %MERGE(MyVar,source) is invoked when a user defined structured system variable appears as an argument on the left hand side of the equal sign of the MERGE command (or when different sub-nodes of the same user defined structured system variable are specified in the same MERGE command).

The subroutine %MERGES(MyVar,destination) is invoked when a user defined structured system variable appears as an argument on the right hand side of the equal sign of the MERGE command.

The subroutine %SET(MyVar,value) is invoked when a user defined structured system variable appears as an argument on the left hand side of the equal sign of the SET command.

Assuming that the routine MyRout is bound to the user defined structured system variable ^$YCust,

SET ^%YCust(123)="Santa Claus"

would cause a call to the subroutine

%SET^MyRout("^$YCust(123)","Santa Claus")

The subroutine can then take care of any cross-referencing activity that may be needed for the application to which ^$YCust belongs, e.g.

%SET(ref,value) NEW glob,old,x
SET glob="^MyApp("_$PIECE(ref,"(",2,$LENGTH(ref)+2)
LOCK +@glob
SET old=$GET(@glob)
SET x=$PIECE(old," ",$LENGTH(old," "))
IF x'="" KILL ^MyApp("Lastname",x,glob)
SET x=$PIECE(value," ",$LENGTH(value," "))
IF x'="" SET ^MyApp("LastName",x,glob)=""
SET @glob=value
LOCK -@glob
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 (system) 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 appear in future standards.
The MDC cannot guarantee that these 'next' standards will indeed appear.