M[UMPS] Commands

S[ET]

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

Usual SET commands:

SET X=1
SET ANSWER="Yes"

Examples with naked references:

SET ^A(8)=8
SET ^(9)=9
SET ^(10,11)=1011
SET ^(^(2,3),^(4,5))=^(6.7)

In these SET commands, the naked indicator changes in the order described below:

Expression Naked indicator Resulting reference
SET ^A(8)=8 ^A( ^A(8)
SET ^(9)=9 ^A( ^A(9)
SET ^(10,11)=14 ^A(10, ^A(10,11)

SET ^(^(2,3),^(4,5))=^(6.7)

Expression Naked indicator Resulting reference
^(2,3) ^A(10,2, ^A(10,2,3)
^(4,5) ^A(10,2,4, ^A(10,2,4,5)
^(6,7) ^A(10,2,4,6, ^A(10,2,4,6,7)
^("x","y") ^A(10,2,4,6,"x", ^A(10,2,4,6,"x","y")

(Assuming that ^A(10,2,3)="x" and ^A(10,2,4,5)="y".)

Addition in the 1984 ANSI M[UMPS] Language Standard:

It is allowed to specify a reference to $PIECE on the left hand side of the equal sign in a SET command.

SET X="This is an test"

Reference   Value
SET $PIECE(x," ",3)="a"   X="This is a test"
SET $PIECE(x," ",2)="was no"   X="This was no test"
SET $PIECE(x," ",3)="a"   X="This  test"

Addition in the 1995 ANSI M[UMPS] Language Standard:

It is allowed to specify a reference to $EXTRACT on the left hand side of the equal sign in a SET command.

SET X="ABCDEFG"

Reference   Value
SET $EXTRACT(X,3)="a"   X="ABaDEFG"
SET $EXTRACT(X,2)="xxx"   X="AxxxaDEFG"
SET $EXTRACT(X,2,6)=""   X="AEFG"

Approved for addition in a future ANSI M[UMPS] Language Standard:

It is allowed to specify a reference to $QSUBSCRIPT on the left hand side of the equal sign in a SET command.

SET N="^|""where""|ABC(11,22,33)"

Reference   Value
SET $QSUBSCRIPT(N,-1)="A"   N="^|""A""|ABC(11,22,33)"
SET $QSUBSCRIPT(N,0)="xxx"   N="^|""A""|xxx(11,22,33)"
SET $QSUBSCRIPT(N,2)=9   N="^|""A""|xxx(11,9,33)"
SET $QSUBSCRIPT(N,10)=123   N="^|""A""|xxx(11,9,33,"","","","","","",123)"

More examples with naked indicators:

SET TO=FROM
SET ^ABC(1,2)="reset naked indicator"
; Naked indicator is now ^ABC(1,
SET ^(3,4)=^(5,6)

; 1. fetch ^(5,6) = ^ABC(1,5,6)
; 2. store ^(3,4) = ^ABC(1,5,3,4)
; Naked indicator is now: ^ABC(1,5,3,

SET (TO,LIST)=FROM
SET ^ABC(1,2)="reset naked indicator"
; Naked indicator is now ^ABC(1,
SET (^(3,4),^(5,6))=^(7,8)

; 1. fetch ^(7,8) = ^ABC(1,7,8)
; 2. store ^(3,4) = ^ABC(1,7,3,4)
; 3. store ^(5,6) = ^ABC(1,7,3,5,6)
; Naked indicator is now: ^ABC(1,5,3,

SET $EXTRACT(VALUE,FROM,TO)=VALUE
SET ^ABC(1,2)="reset naked indicator"
; Naked indicator is now ^ABC(1,
SET $EXTRACT(^(3,4),^(5,6),^(7,8))=^(9,10)

; 1. fetch ^(5,6) = ^ABC(1,5,6)
; 2. fetch ^(7,8) = ^ABC(1,5,7,8)
; 3: if ^ABC(1,5,6,7) < ^ABC(1,5,6) or if ^ABC(1,5,6,7) < 1
; don't store, naked indicator is ^ABC(1,5,7,9,
; else continue
; 4. fetch/store ^(3,4) = ^ABC(1,5,7,9,3,4)
; Naked indicator is now: ^ABC(1,5,7,9,3,

SET $PIECE(VALUE,STRING,FROM,TO)=VALUE
SET ^ABC(1,2)="reset naked indicator"
; Naked indicator is now ^ABC(1,
SET $PIECE(^(3,4),^(5,6),^(7,8),^(9,10))=^(11,12)

; 1. fetch ^(5,6) = ^ABC(1,5,6)
; 2. fetch ^(7,8) = ^ABC(1,5,7,8)
; 3. fetch ^(9,10) = ^ABC(1,5,7,9,10)
; 4. if ^ABC(1,5,7,9,10) < ^ABC(1,5,7,8) or
; if ^ABC(1,5,7,9,10) < 1
; don't store, naked indicator is ^ABC(1,5,7,9,11,
; else continue
; 5. fetch/store ^(3,4) = ^ABC(1,5,7,9,11,3,4)
; Naked indicator is now: ^ABC(1,5,7,9,11,3,


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 commands 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.