NOW LET US – AI RAG SaaS Studio TP.HCM
NOW LET US
Digital Product Studio
Back to news
DEV-TOOLS...6 min read

The MUMPS 76 Primer – anniversary edition

Share
NOW LET US Article – The MUMPS 76 Primer – anniversary edition

An introduction to MUMPS 76, a pioneering programming language and integrated NoSQL database system created in 1966 that laid the foundation for modern medical databases.

    1. Introduction
    1. The Language at a Glance
    1. Variables and Data Types
    1. Expressions and Operators
    1. Commands
  • 5.1. SET — Assign a Value

  • 5.2. WRITE — Output Data

  • 5.3. READ — Input Data

  • 5.4. IF and ELSE — Conditional Execution

  • 5.5. Post-Conditionals

  • 5.6. FOR — Repetition

  • 5.7. DO — Call a Subroutine

  • 5.8. GOTO — Transfer Control

  • 5.9. QUIT — Return from Subroutine or Exit FOR

  • 5.10. HALT and HANG

  • 5.11. XECUTE — Execute a String as Code

  • 5.12. KILL — Delete Variables

  • 5.13. BREAK

    1. String Functions
  • 6.1. $LENGTH — String Length

  • 6.2. $EXTRACT — Substring by Position

  • 6.3. $PIECE — Substring by Delimiter

  • 6.4. $FIND — Search for Substring

  • 6.5. $JUSTIFY — Right-Justify and Format Numbers

  • 6.6. $ASCII and $CHAR — Character Code Conversion

  • 6.7. $RANDOM — Random Number

  • 6.8. $SELECT — Conditional Expression

  • 6.9. $TEXT — Retrieve Source Line

    1. The Global Database
    1. Input/Output
    1. Indirection
    1. Special Variables
    1. Routines and Program Structure
    1. Putting It All Together
    1. Command Reference
    1. Function Reference
    1. Special Variables Reference
    1. Operators Reference
    1. Syntax Summary
  • Appendix A: ASCII Code Table

  • Appendix B: Glossary

    1. What We Have Not Covered
  • References

In 1966, at the Laboratory of Computer Science at Massachusetts General Hospital in Boston, Octo Barnett, Neil Pappalardo, and Curtis Marble created a programming language called MUMPS — the Massachusetts General Hospital Utility Multi-Programming System.

MUMPS was born from a practical need: hospitals required a system where doctors and nurses could simultaneously access and update patient data from multiple terminals, in real time, on affordable hardware. In 1966, "affordable hardware" meant a DEC PDP-7 with 8K words of memory and a small disk. There was no room for separate layers — no separate operating system, file system, database server, and application language stacked on top of each other. Everything had to be one integrated system.

What emerged was something remarkable: a programming language with a built-in hierarchical database — what the database world would not have a name for until four decades later: a NoSQL database with an integrated programming language.

The core data abstraction in MUMPS is the global variable: a hierarchical, sparse array that is stored persistently on disk and shared among all concurrent users. In today’s terms, globals are a schema-free, ordered key-value store with composite keys, created on first assignment and deleted on demand.

SET ^PATIENT(12345,"NAME")="Smith, John" SET ^PATIENT(12345,"DOB")="1945-03-15" SET ^PATIENT(12345,"LAB","2024-01-15","GLUCOSE")=95

There is no CREATE TABLE, no schema definition, no INSERT statement. You simply SET a value at a hierarchical path, and the system creates whatever intermediate nodes are necessary. KILL a node, and the entire subtree beneath it disappears.

Consider what MUMPS had in 1966 that the rest of the computing world would spend decades reinventing:

  • Schema-free storage: No declarations required. Nodes are created on first assignment. This is what MongoDB would call "schemaless documents" in 2009.
  • Hierarchical data model: Patient records naturally form trees. MUMPS globals mirror this structure directly. This is what Firebase would call "real-time hierarchical data" in 2012.
  • Ordered key traversal: The $NEXT function walks through sibling nodes in sorted order without an explicit index — what Redis would call "sorted sets" in 2009, or LevelDB "ordered iteration" in 2011.
  • Integrated language and database: There is no impedance mismatch. Variables and database nodes use the same syntax, the same data types, the same operations.

All of this ran on a machine with 8 kilobytes of memory, serving multiple simultaneous users.

By the early 1970s, multiple vendors had created their own incompatible MUMPS dialects. The MUMPS Development Committee (MDC), formed in 1972, set out to create a common standard. The result was published in January 1976 by the U.S. National Bureau of Standards as NBS Handbook 118: "MUMPS Language Standard". A companion document, the Programmers' Reference Manual (MDC/42), was written by Melvin Conway (of "Conway’s Law" fame) later that year. Together they form the first complete, formal specification of MUMPS.

The 1976 standard is astonishingly minimal:

  • 19 commands: BREAK, CLOSE, DO, ELSE, FOR, GOTO, HALT, HANG, IF, KILL, LOCK, OPEN, QUIT, READ, SET, USE, VIEW, WRITE, XECUTE
  • 12 functions: $ASCII, $CHAR, $DATA, $EXTRACT, $FIND, $JUSTIFY, $LENGTH, $NEXT, $PIECE, $RANDOM, $SELECT, $TEXT
  • 7 special variables: $HOROLOG, $IO, $JOB, $STORAGE, $TEST, $X, $Y

That is the entire language. No JOB command (no programmatic multi-tasking). No NEW command (no local variable scoping — that came in 1984). Subscripts restricted to nonnegative integers for portability. Maximum string length of 255 characters. Yet this was sufficient to build hospital information systems serving millions of patients.

This primer covers exactly this 1976 standard — the essential, crystallized MUMPS, before decades of extensions.

This book is for programmers who are fluent in at least one other language and want to understand what MUMPS was, how it worked, and what made it historically significant. You do not need any prior MUMPS experience.

The book serves three purposes:

  • Introduction: What MUMPS is and why it matters.
  • Tutorial: A progressive, example-driven walkthrough of the language that you can follow along interactively.
  • Quick reference: A summary of all commands, functions, and special variables for the 1976 standard.

We focus on single-user operation. Multi-user features like LOCK and device sharing are mentioned where relevant, but their full treatment is deferred.

To follow along with the examples, start the MUMPS interpreter in interactive mode. You will see a prompt:

At this prompt you can type any MUMPS command and it will be executed immediately. Try:

WRITE "Hello, World!",! Hello, World!

The ! after the comma is a format code that produces a new line. We will explain the syntax in detail shortly.

To exit the interpreter, type:

HALT

You can also run MUMPS programs in batch mode by loading routine files. But for learning, interactive mode is ideal — it gives you immediate feedback on every command.

Before diving into the details, here is a bird’s-eye view of MUMPS for the programmer coming from another language. MUMPS has several features that will feel unfamiliar — deliberately so, because they reflect a different set of design trade-offs.

MUMPS has exactly one data type: the character string. Numbers are simply strings that happen to look numeric. The string "42" and the number 42 are the same value. When you perform arithmetic, MUMPS automatically interprets strings as numbers; when you concatenate, it treats values as strings. There are no type declarations, no type errors, and no conversions to worry about.

All binary operators are evaluated strictly left to right. There is no multiplication-before-addition rule. The expression 2+34 evaluates to 20, not 14, because 2+3 is computed first (giving 5), then 54 gives 20. Use parentheses to override this: 2+(3*4) gives 14.

This is unfamiliar, but it eliminates an entire class of bugs related to precedence misunderstandings.

A MUMPS program is a sequence of lines. Each line has an optional label (for reference by DO, GOTO, or $TEXT), followed by a mandatory space separator, followed by zero or more commands separated by single spaces:

LABEL command1 argument command2 argument ;comment

Spaces are syntactically significant. A single space separates the command word from its argument. Two spaces (or end of line) separate an argumentless command from the next command or comment. A semicolon begins a comment that extends to the end of the line.

© 2026 Now Let Us. All rights reserved.

Source: Hacker News

Advertisement
Ad slot ready: 5887729102

More in this category

NOW LET US Related – The curious case of the disappearing Polish S

dev-tools

The curious case of the disappearing Polish S

A fascinating deep dive into a bizarre keyboard bug on Medium that prevented Polish users from typing the letter 'ś', tracing its roots back through decades of history, hardware limitations, and OS quirks.

NOW LET US Related – A way to exclude sensitive files issue still open for OpenAI Codex

dev-tools

A way to exclude sensitive files issue still open for OpenAI Codex

Developers are pushing for a feature to exclude sensitive files in OpenAI Codex to prevent data leaks of security keys and environment configurations. Despite being proposed earlier, an official solution remains unimplemented.

NOW LET US Related – Show HN: Adrafinil – keep a lid-closed Mac awake only while agents work

dev-tools

Show HN: Adrafinil – keep a lid-closed Mac awake only while agents work

Adrafinil is a macOS menu bar app that keeps your Mac awake—even with the lid closed—exclusively while AI coding agents are actively working. Unlike always-on utilities, it restores normal sleep behavior the moment the agent finishes its task.

NOW LET US Related – Turn your site into a place people can bump into each other

dev-tools

Turn your site into a place people can bump into each other

Town Square is an open-source widget that transforms static websites into interactive spaces where real-time visitors can see each other as avatars and chat, bringing back the nostalgic human connection of the early web.

NOW LET US Related – Anonymous GitHub account mass-dropping undisclosed 0-days

dev-tools

Anonymous GitHub account mass-dropping undisclosed 0-days

An anonymous security researcher has consolidated and released a massive archive of zero-day and one-day vulnerability PoCs affecting major software like Firefox, Docker, and FFmpeg, leveraging AI-driven fuzzing workflows.

NOW LET US Related – Post-Mythos Cybersecurity: Keep calm and carry on

dev-tools

Post-Mythos Cybersecurity: Keep calm and carry on

The emergence of Claude Mythos has sparked concerns over AI-driven automated zero-day hunting and exploitation. However, a closer look reveals that this technology represents a gradual evolution rather than a sudden revolution in the cybersecurity landscape.

EXPLORE TOPICS

Discover All Categories

Deep dive into the specific technology sectors that matter most to you.