M[UMPS] Commands

E[LSE]

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

The most common If-Then-Else construction is:
IF X=4 SET A=5
ELSE  SET A=6

But
IF X=4 DO SUB
ELSE  QUIT

may produce an unexpected result if the program assumes that the value of $TEST does not change within the subroutine SUB.

If the code in the above example was intended as an If-Then-Else construction, then it would be better to write it as:
QUIT:X'=4  DO SUB

OPEN DEVICE::20 ELSE  WRITE "..." QUIT
Don't process any data when resources cannot be allocated.

LOCK +^ABC:20 ELSE  WRITE "..." QUIT
Don't update while someone else is editing

IF VAR=VALUE LOCK ^NAME:TIMEOUT SET X=1
ELSE  SET X=2

In this case... it depends. In the case where the values of VAR and VALUE are not equal, local variable X will be set to 2, but in the case whare those two variables do have the same value, the value of $TEST may become false if the time-out expires, in which case the ELSE command will also allow X to be set to 2.


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.