The MUMPS 76 Primer – anniversary edition
The MUMPS 76 Primer: Anniversary Edition
This document serves as a comprehensive introduction and tutorial focusing on the 1976 Standard of the MUMPS programming language.
1. Origins and Philosophy
In 1966, within the Laboratory of Computer Science at Massachusetts General Hospital (Boston), a trio of innovators—Octo Barnett, Neil Pappalardo, and Curtis Marble—developed a system known as MUMPS (Massachusetts General Hospital Utility Multi-Programming System).
The Problem Space
The language was a response to a critical practical requirement: medical staff needed to retrieve and modify patient records in real-time from various terminals. This had to be achieved using hardware that was considered "affordable" at the time.
The Hardware Constraints (1966):
| Component | Specification |
|---|---|
| Machine | DEC PDP-7 |
| Memory | 8K words |
| Storage | Small disk drive |
Because resources were so scarce, the developers could not afford the overhead of a traditional software stack. They eliminated the boundaries between layers:
Operating System File System Database Server Application Language
Instead, they created a unified entity: a programming language with an embedded hierarchical database. In modern terminology, MUMPS was a NoSQL database with an integrated language decades before the term "NoSQL" existed.
2. The Core Innovation: Global Variables
The fundamental data structure in MUMPS is the global variable. Unlike local variables, globals are:
- Persistent: Stored on disk.
- Shared: Accessible by all concurrent users.
- Hierarchical: Organized as a sparse, ordered array.
Mathematically, a global can be viewed as a function mapping a sequence of subscripts to a value:
Practical Example
There are no CREATE TABLE or INSERT commands. Data is created simply by assigning a value to a path:
SET ^PATIENT(12345,"NAME")="Smith, John"
SET ^PATIENT(12345,"DOB")="1945-03-15"
SET ^PATIENT(12345,"LAB","2024-01-15","GLUCOSE")=95
Historical Foresight
MUMPS implemented concepts in 1966 that the industry spent the next 40 years "rediscovering":
- Schema-free storage: No need for declarations (similar to MongoDB's schemaless documents, c. 2009).
- Hierarchical data models: Data naturally forms trees (similar to Firebase's real-time data, c. 2012).
- Ordered key traversal: The
$NEXTfunction allows walking through siblings in sorted order (similar to Redis sorted sets or LevelDB iteration). - Zero Impedance Mismatch: Because the language and database are one, variables and database nodes share the same syntax and types.
Figure 1: The type of hardware that powered early MUMPS installations.
3. The 1976 Standard
By the 1970s, various vendors had developed diverging, incompatible versions of MUMPS. To solve this, the MUMPS Development Committee (MDC) was established in 1972.
Their work resulted in two seminal documents:
- NBS Handbook 118: The "MUMPS Language Standard."
- MDC/42: The Programmers' Reference Manual, authored by Melvin Conway (the namesake of Conway's Law).
Language Specifications
The 1976 standard is a masterpiece of minimalism. The entire language consists of:
Commands (19)
-
BREAK -
CLOSE -
DO -
ELSE -
FOR -
GOTO -
HALT -
HANG -
IF -
KILL -
LOCK -
OPEN -
QUIT -
READ -
SET -
USE -
VIEW -
WRITE -
XECUTE
Functions (12)
$ASCII, $CHAR, $DATA, $EXTRACT, $FIND, $JUSTIFY, $LENGTH, $NEXT, $PIECE, $RANDOM, $SELECT, $TEXT
Special Variables (7)
$HOROLOG, $IO, $JOB, $STORAGE, $TEST, $X, $Y
Note on Limitations: To ensure portability, subscripts were restricted to non-negative integers. Additionally, the
NEWcommand (which provides local variable scoping) did not exist in the 1976 standard; it was introduced later in 1984.
4. Guide Overview
Target Audience
This primer is designed for experienced developers who are already proficient in at least one programming language and wish to explore the historical significance and mechanics of MUMPS.
Objectives
The text is structured to provide:
- An Introduction: Contextualizing what MUMPS is and its importance.
- A Tutorial: A step-by-step, interactive guide using concrete examples.
- A Quick Reference: A condensed summary of the 1976 standard's syntax.
Note: While multi-user capabilities (like LOCK) are mentioned, they are not the primary focus of this introductory text.
Getting Started
To begin experimenting, launch the MUMPS interpreter in interactive mode.
- The Prompt: Once the interpreter starts, you will see a prompt. You can enter any command here for immediate execution.
- Exiting: To shut down the interpreter, use the command:
HALT - Batch Mode: While you can load routine files for batch processing, interactive mode is recommended for learners to receive instant feedback.
5. The Language at a Glance
(The original text ends here, transitioning into the detailed technical breakdown...)