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

gvn

M[UMPS] by Example

Global variables can be referenced in many ways. A “normal” reference would look like
Set ^name(1,"abc",3)="some text"

In the 1984 ANSI M[UMPS] language standard, the concept of “multi-level indirection” was introduced. This way of referencing separates a “root”, which can be either just a name or a name with one or more subscripts, from a list of subscripts, which means that the above reference could be written in a number of different ways as well:
Set root="^name",@root@(1,"abc",3)="some text"
Set root="^name(1)",@root@("abc",3)="some text"
Set root="^name(1,""abc"")",@root@(3)="some text"
Set root="^name(1,""abc"",3)",@root="some text"

This feature also offers a simple mechanism to display a complete (sub)tree of a global variable:

Show(root)  Write:$Data(@root)#2 !,root," = ",@root
Set sub="" For  Set sub=$Order(@root@(sub)) Quit:sub="" Do Show($Name(@root@sub))
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-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 17-Nov-2023, 11:24:33.

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