Category : Miscellaneous Language Source Code
Archive   : MUMPS.ZIP
Filename : USER.DOC

 
Output of file : USER.DOC contained in archive : MUMPS.ZIP











MICROMUMPS



USER MANUAL





Version 5





Division of Computer Science
University of California
Davis, CA 95616





William Yaksick
Richard F. Walters



December, 1986
























Introduction

A single user version of Standard MUMPS has been implemented on
8086/88 and compatible microcomputers operating under the PCDOS
(MSDOS) Operating system. This research has been supported in
part by the Veterans Administration, the MUMPS Systems Laborato-
ry, Nagoya, Japan, Shared Medical Systems, the Lister Hill Na-
tional Center for Biomedical Communications of the National Li-
brary of Medicine, IBM Corporation, Cornell University and the
University of California. It is distributed by the University of
California, Davis, and by the MUMPS Users Groups of England,
Japan and Brazil.

In its current version, MicroMUMPS includes all commands of the
ANSI Standard applicable to single user versions. This manual
describes extensions to the MUMPS language that are included in
MicroMUMPS. In general, direct I/O extensions conform to those
of DSM and ISM implementations. Some special capabilities avail-
able at the micro-computer level are also described in this manu-
al.



Initiating MicroMUMPS

To enter the MUMPS interpreter, begin by turning on the machine
and initiating the operating system. Then type ``MUMPS'', and
the interpreter will be loaded. When loaded, the interpreter
will give an initial message identifying the Version number and
then display a prompt ``>'', which is repeated each time the in-
terpreter is awaiting further input from the user. If MUMPS has
been configured for auto execute mode using the SETMUMPS utility,
then the command line entered during setup will be executed in-
stead of the initial prompt. See the SETMUMPS utility documenta-
tion for more information on auto execute mode.

To exit MUMPS, type HALT or H, and the monitor will once again
assume control of the system. ALWAYS EXIT USING THE HALT command
to allow the system to rewrite all modified global files before
returning control to the operating system. Failure to do so may
result in loss of data in the global files.


Special Features of MicroMUMPS

MicroMUMPS now includes all the features added to Standard MUMPS
for inclusion in the ANS 1984 standard. These features are:


SET $PIECE The syntax SET $PIECE(X,delim,n)=``NEW VALUE'' es-
tablishes NEW VALUE as the nth piece of variable X.

$ASCII(expr1,intexpr2) returns the $ASCII function on the
intexpr2th character of expr1

$EXTRACT(expr) returns the first character of the value of
expr.

$JUSTIFY now includes a leading zero in front of decimal frac-
tions between -1 and 1.

$LENGTH (exprl, expr2) gives the number of non overlapping
times expr2 occurs in expr1.

$TEXT(+0) returns the name of the routine.

Pattern match: alternating forms permitted (see newsletter)

READ A#n reads up to n characters, terminating at n.


In addition to permitting string subscripts, decimal subscripts
are also allowed in MicroMUMPS. Note that the collating order
specified by the MUMPS Development Committee treats ``canonical
numbers'' as special cases, separating them from other numbers
and alphanumeric strings. See the section on Language Extensions
for further details on this topic.

Adherence to Portability Requirements of the MUMPS Standard

This version of Standard MUMPS adheres to or exceeds all provi-
sions specified in part III of the ANSI Standard X11.1. String
variables may be up to 255 characters in length, numeric preci-

sion is maintained to a minimum of nine significant digits, ex-
tensible to 14. Numbers up to 10 raised to the 25th power can be
represented, subscripts may be up to 63 characters, etc. Some
versions (distributed in Japan and China) permit use of the 8th
bit in character representation and permit manipulation of two-
byte characters.


Implementation-Specific Features of MicroMUMPS

ANSI X11.1 1984 reserves for the implementor a number of language
elements. This section describes briefly the manner in which
some of those features have been treated in MicroMUMPS

1. Direct entry of routine lines

MUMPS can be executed by direct commands, processed as soon as
they are typed, or by executing stored routines. Provision must
be made for the entry of command lines that can be stored as rou-
tines. In MicroMUMPS, the TAB character (control - I on some
keyboards) is used to signal the start of a command line that is
to be stored in the workspace. The Tab character echoes as a
space (a change from earlier versions). Multiple Tabs are permit-
ted for indentation purposes. Multiple spaces between commands
are also allowed.

When inserting new command lines into text, they are placed im-
mediately IN FRONT of the current text pointer which is then up-
dated to point after the inserted line. Extensions that permit
manipulation of the current text pointer are described in the
section on language extensions.

When a routine is entered from an editor, the linestart character
may be any combination of one or more tabs or spaces.

2. Control Character Functions

A number of special characters are interpreted by MicroMUMPS to
provide specific actions similar to those encountered in the
operating system. These characters are:


Control- A information typed to next carriage return is not
echoed.

Control- C interrupt execution. Return to direct mode. The
system can be configured to ignore Ctrl-C using the SETMUMPS
utility or BREAK 0 (see below).

Control- G talk-through mode. Everything typed until next
Ctl-G is transmitted directly to output port, and informa-
tion received from port is echoed to screen. This feature
can be disabled, and MicroMUMPS is delivered with the
feature inactive, since it will cause a system to hang if an
external port is not connected.

Control- H backspace and delete character.

Control- P echo to printer.

Control- S pause output. Resume by typing any char. (See
special note in introduction for PCDOS.)

Control- X remove line, erasing it from screen.

rubout backspace and delete character.

3. BREAK and ZGO Commands

The ANSI Standard does not specify completely the BREAK command.
In this version, BREAK may be used in several ways.

BREAK 0 disables control-C interrupt
BREAK 1 enables control-C interrupt
BREAK (arg) halts execution and types out argument
BREAK (var) types the value of the variable var

Return to execution following interruption by a BREAK command is
accomplished by the ZGO command, which picks up routine execution
at the point at which it was suspended. In addition, ZGO may be
used with Control-C, when used in indirect mode, as shown below.

ZGO (no args) returns to normal execution
ZGO 1 executes a single command then returns
to BREAK mode.
ZGO 2 completes execution of the current line and the
first command on the following line.

4. READ * and WRITE *; READ A#n

The READ * syntax of Standard MUMPS permits user definition of
the interpretation of this special command. In MicroMUMPS, the
suggestion contained in the MUMPS Programmer's Reference Manual
is followed, and READ * is used to implement a single character
READ for use in those programs where single character input is an
important requirement of certain applications. When MUMPS en-
counters the READ command followed by an asterisk, it returns a
single character which is the ASCII code equivalent of the char-
acter entered from the keyboard. Note that the READ * command
does not echo the character typed to the screen.

READ A#n, where n is the number of characters to be read, will
cause the READ to be terminated either when n characters have
been typed or when a carriage return is typed. This form of the
READ command is a new feature of 1984 ANS MUMPS.

5. $STORAGE

The special variables $STORAGE returns a number equivalent to the
number of unused bytes of storage remaining in the user
workspace. This value is only minimally affected by creation of
new variables (two bytes are used to store an address for each
variable). The remainder of the space is used for storing the
current active Routine.

6. VIEW Command

VIEW is implemented with a single argument that may have the
values 0 through 5. The meaning of these values is defined as
follows:

0 returns a list of local variable names and values
1 returns local variable names, subscripts and
values of local subscripted variables
2 returns a list Global Variable Names
3 returns a list of MUMPS routines in routine file
4 returns a directory of all files available to
that user on default I/O drive
5 returns a directory of *.MMP ASCII files on disk

7. HANG and Timeout Functions

The HANG command permits a pause of specified number of seconds.
Likewise, various commands such as READ allow for a timeout in
the same units. Because of difference in processing speeds, the
exact time may vary.

8. OPEN #: (parameters)

OPEN allows assignment of different I/O and disk devices and
files. The device assignments currently available in OPEN, CLOSE
and USE are:

0 the primary input device (console/keyboard)
1 printer (listing device)
2 disk file
3 disk file
4 disk file
5 Serial Port

Open 0 is ignored, since the primary input device is automatical-
ly opened when MUMPS is invoked. If OPEN is invoked with either
1 or 5 as the device specification, parameters are ignored.

An OPEN command specifying one of the disk files requires the
syntax (DRIVE:FILENAME). Failure to specify parameters will gen-
erate an error. These two parameters may be string variables or
quoted constants. For example,

OPEN 3:(``A'':``TEST.ASM'')

will assign to device number 3 the ASCII file TEST.ASM. Note the
necessity for both quotation marks and parentheses in this
specification. If variables have been previously set, they may
also be used. For example, if X=``A'' and Y=``TEST.ASM'', then
the command

OPEN 3:(X:Y)

is a valid syntax for this command.

MicroMUMPS also permits addition of a record at the end of an ex-
isting file. The syntax for this variation of the OPEN command
is:

OPEN 3:(``A'':``FILE.EXT'':``END'')

Thereafter, any records written to that file are added at the
end. See the description of the USE command for random
read/write of files. See also your operating systems manual for
specification of random file I/O.

9. CLOSE #: options

CLOSE refers to the same files and devices specified in OPEN and
USE, described above. The two options available are 0 (close and
lock the file), and 1 (purge the file and close it). For exam-
ple,

CLOSE 3:0 (closes and saves the file specified as device 3)

CLOSE 2:1 (erases the file referred to as device 2)

The default value (if no number appears after the colon) is to
leave the file in the status it was in when MUMPS use of the file
started (a new file is deleted, an old file retained).

NOTE: When exiting MUMPS, it is essental to close files prior to
typing HALT, so as to avoid loss of data in existing buffers.

10. USE #

USE instructs the interface to direct I/O to the device/file
specified. USE 1 directs output to the printer, USE 2 references
read and write commands to the file specified, etc.

The USE command has several variations that can be used with dev-
ices 2,3 and 4 to permit appending data at the end of a sequen-
tial file and accessing directly records in a random file. For a
sequential file,

USE 2:``END'' will move the file pointer to the end of
the current file and add data at that point. This option should
only be used when a pre-existing file has been opened.

Random files must first be declared outside MUMPS using standard
operating system procedures. Individuals who are not familiar
with these procedures should not attempt to use this feature.
When a random file exists, the syntax

USE 2:n

where n is the sector number to be read, will move the pointer to
that location so that the next READ or WRITE is of the desired
sector. An alternate syntax,

USE 2:n

addresses the m-th byte of the n-th sector. READ and WRITE ac-
tions are permitted in this mode, but extreme care is required
not to overflow the existing file structure. In general, this
option is intended only for the advanced programmer who is al-
ready familiar with MSDOS or CP/M. Potential hazards of its
misuse include a) unknown errors when the user attempts to write
past the end of a random file and b) disruption of the address-
ing when a sector is overflowed.

11. SET $X and SET $Y

Frequently, it is desirable, in screen formatting-dependent rou-
tines, to redefine the $X and $Y special variables to conform to
new locations of the cursor after terminal-specific write se-
quences have been executed. MicroMUMPS uses the same convention
that has been adopted by several commercial versions of Standard
MUMPS - $X and $Y may be set by the user, who must write special
routines to accomplish this function. MicroMUMPS now supports
this feature.

12. WRITE (without arguments)

Several commercial MUMPS systems (DSM, M-11, etc.) use WRITE
without arguments as a way to view local variables. In order to
make use of MicroMUMPS as convenient as possible for individuals
who use these versions, we have implemented WRITE with no argu-
ments to perform exactly the same function as VIEW 0. The list
of variables is displayed, but subscripted values are not
displayed.

MSDOS Specific Features

1. Terminal I/O

The IBM PC does not allow for single character form feed control.
Version 2.0 and subsequent releases permit escape sequence con-
trols for various screen functions. Refer to your operating sys-
tem manual to determine if these functions are available on your
system. Use WRITE *nn where nn is the decimal value of an ap-
propriate ASCII code to accomplish these functions.

2. Serial Port I/O

Input and output of data on a serial line other than the system
console is supported in this version of MicroMUMPS. The facility
is provided using standard calls for auxiliary input/output ports
devices as described in the MSDOS documentation. It is necessary
to set the speed and character length outside MUMPS. Note that
at higher baud rates it is possible to lose characters, since in-
terrupt handling and buffering is not provided in MSDOS calls.

3. Sequential File I/O

As described above, MicroMUMPS provides features that allow read-
ing and writing of sequential ASCII files. The OPEN, USE, READ
and WRITE commands operate like the SDP files provided by DSM-11.
A single CNTRL/Z is returned to the MUMPS routine when an End of
File is detected on reads. This facility is useful for writing
MUMPS routines or globals to backup data and for interface to
other languages or word processors. These features may also be
used in conjunction with external MSDOS ports to transfer files
between systems.

Z-Command Extensions

The ANS MUMPS Standard provides a means to extend the language to
take care of I/O and other features not fully specified in the
standard. In most cases, syntax of the MicroMUMPS Z extensions
are similar or identical to DSM and ISM comparable commands. In
one or two instances,, minor differences exist. Users familiar
with DSM, ISM, or with earlier versions of MicroMUMPS should note
these language features carefully to avoid potential confusion or
misuse.

ZCALL is a complex function allowing users to invoke assembly
language routines from within MUMPS. This feature is
described separately at the end of the User Manual.
$ZCOUNT returns the number of free blocks available in
GLOBALS.DAT. It can be used in program mode to avert any
problems of overflowing allocated global area.

ZD(ELETE) will delete a routine file from the Routines
file. This command is different from the DSM and ISM method
of deleting disk copies of routines. ZDELETE can take
several forms.

ZD(ELETE) NAME will delete the MUMPS routine called NAME

ZD(ELETE) (name:n) where the parameter `n' may either
be M (or m), denoting a MUMPS routine, or Z (or z) to denote
an assembly routine.

ZDELETE may also take the following variations:

ZD(ELETE) "lower" deletes a MUMPS routine with the
name lower (in lower case letters). ZD(ELETE)
("lower":"M") same as the previous example ZD(ELETE)
("ASMB":"z") deletes the assembly routine ASMB



ZE(RROR) When an error is encountered and the ZERROR
has been set, the error message giving the location of the
error is displayed (pointer to command, label plus offset).
If ZERROR has arguments, control will pass to the
entryref^routine in the argument.

ZF(ETCH) is used to fetch an operating system file and place it
in the current library file. Two forms are available:

ZF(ETCH) assumes that the file pointed to by
is an MSDOS file with the extension type .MMP.

ZF(ETCH) , where `n' may take the value M (or m)
to refer to MUMPS routines, and Z (or z) to refer to assem-
bly routines. In either case, the file is loaded into the
routine library file.

The parameter may include wildcard characters.
When in command (direct) mode, the ZFETCH command will re-
port all fully expanded filenames as they are loaded. For
example, to load all the MUMPS routines of the VA File
Manager from a distribution disk,

ZFETCH "A:\FMGR\DI*.MMP"

will load and report the name of all MUMPS routines starting
with DI in the FMGR subdirectory of the floppy disk on Drive
A.

It is permitted to have MUMPS routines and assembler .OBJ
routines with the same name, since they are accessed in dif-
ferent ways within MUMPS (assembly routines are only invoked
via the ZCALL command).
$ZG(LOBAL) returns the drive name on which globals are currently
located. It is useful in program mode to manage files when
multiple disks are used.

ZI(NSERT) :

  3 Responses to “Category : Miscellaneous Language Source Code
Archive   : MUMPS.ZIP
Filename : USER.DOC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/