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

Indirect Operator

M[UMPS] by Example

Right Hand Pointer

Indirection operator (@)

Introduced in the 1977 ANSI M[UMPS] language standard.

Three types of indirection:

Name indirection

Set X="ABC"
IF 123+@X=456

Argument indirection

Set SPACE="!!!",PAGE="#"
Write @$Select(ENOUGH:SPACE,1:PAGE)

Pattern indirection

Set CODE="3U"_$Select(SPECIAL:"2N",1:"")_"5L"
If X?@CODE

Addition in 1984 ANSI M[UMPS] language standard.

Fourth type of indirection, subscripted reference indirection:

Set ARRAY="PRICES"
Set PRICE=(100+SALESTAX/100)*@ARRAY@(1,2,3)

Set ARRAY="^CUSTOMER(123,45)"
Set TOTAL=TOTAL+@ARRAY@(2,3,4)

Approved for addition in a future M[UMPS] Language standard.

Fifth type of indirection, "generic" indirection.

This new type of indirection involves a "catch-all" recovery after all other types of indirection have been attempted by a M[UMPS] language processor. When code is encountered that uses indirection, and none of the above forms of indirection leads to a valid interpretation of the code, the indirection operator and the expression on which it operates are to be replaced by the value of the expression in question, and then the line of code is to be re-evaluated. This may lead to some surprising possibilities:

Set X1="Y"
Set X2="Z="
Set X3="SecretAccnt=1E9,N"
Set X4="N=1 HALT"
Set Y="Example"
Set Y1="Example1"
Set Z1="Program"
Set Z2="TAG^Program"
Set Z3="(1,2,3)"
Set Z4=",2,3,4)"

With these values:

Set @X1="HELLO"
will be executed as: Set Y="HELLO"

Set @X2"HELLO"
will be executed as: Set Z="HELLO"

Set @X3="HELLO"
will be executed as: Set SecretAccnt=1E9,N="HELLO"

Set @(X1)1="New Value"
will be executed as: Set Y1="New Value"

Do ^@(Z1)(1,2,3)
will be executed as: Do ^Program(1,2,3)

Do @(Z2)(1,2,3)
will be executed as: Do TAG^Program(1,2,3)

Do @(Z2)@Z3
will be executed as: Do TAG^Program(1,2,3)

Do @(Z2)("BLUE"@Z4
will be executed as: Do TAG^Program("BLUE",2,3,4)

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 28-Nov-2011, 20:03:46 .

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