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

^$Y*

M[UMPS] by Example

Right Hand Pointer

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

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 13-Sep-2014, 16:52:55 .

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