M[UMPS] Commands

R[EAD]

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

READ "Please enter your name: ",NAME
WRITE "Please enter your name: " READ NAME

Both lines of code seemingly have the same effect. On some implementations, the former example has the side-effect to flush the type-ahead buffer.

READ X#20
Read a string of fixed length (do not wait for a terminator).

READ X:20
Read a string. When a 'terminator' key is pressed, the READ command will be satisfied. If, after 20 seconds, no 'terminator' key has been pressed, the READ command will also be satisfied. In this case, the value returned in X is 'as many characters as have been entered before the time-out elapsed'.

READ *X:20
Read a single character. The value returned in X will be an integer number. If the time-out expires, this value will be -1.

Addition in the 1984 ANSI M[UMPS] language standard.

READ X#1
READ *X

Both lines of code read one single character. The first line always returns a string of length 1 in local variable X. The second line returns an integer value in local variable X; although practically all implementations return the ASCII code of the character processed, the value returned in local variable X is implementation-specific and device specific and it is not to be considered portable to rely on a specific value being returned.

Addition in the 1995 ANSI M[UMPS] language standard.

READ ^ABC
It is allowed to read values directly into global variables.

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

The ability to specify an "output time-out" is added. An output time-out is specified as a device parameter in an OPEN or USE command. Examples are shown with the USE command.

User-definable I/O handling has been added. When user-definable I/O handling is active:

Examples with naked references:

READ VARIABLE
SET ^ABC(1,2)="reset naked indicator"
; Naked indicator is now ^ABC(1,
READ ^(3,4)

; Naked indicator is now: ^ABC(1,3,
; Actual reference is: ^ABC(1,3,4)


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.