The MUMPS 76 Primer – anniversary edition
Key takeaways
- Building a Data Model 7.3. $DATA — Testing Whether a Node Exists 7.4. $NEXT — Walking the Tree 7.5.
- 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.
- 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.
Table of Contents 1. Introduction 1.1. What is MUMPS? 1.2. The 1976 Standard 1.3. Who This Book Is For 1.4. Getting Started 2. The Language at a Glance 2.1. Everything Is a String 2.2. No Operator Precedence 2.3. Line-Oriented Structure 2.4. Commands Are Terse 2.5. The Persistent Database Is Built In 3. Variables and Data Types 3.1. Local Variables 3.2. Subscripted Variables 3.3. Strings, Numbers, and Automatic Conversion 3.4. Truth Values 4. Expressions and Operators 4.1. Strict Left-to-Right Evaluation 4.2. Arithmetic Operators 4.3. Unary Operators 4.4. Relational Operators 4.5. Logical Operators 4.6. The Concatenation Operator 4.7. Pattern Match 5. 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 6. 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 7. The Global Database 7.1. Global Variables 7.2. Building a Data Model 7.3. $DATA — Testing Whether a Node Exists 7.4. $NEXT — Walking the Tree 7.5. The Naked Reference 7.6. KILL on Globals 8. Input/Output 8.1. Formatting Output 8.2. The Special Variables $X and $Y 8.3. Device I/O (Overview) 9. Indirection 9.1. Name Indirection 9.2. Subscript Indirection 9.3. Argument Indirection 9.4. Pattern Indirection 10. Special Variables 10.1. $HOROLOG — Date and Time 10.2. $IO — Current Device 10.3. $JOB — Process Identifier 10.4. $STORAGE — Available Space 10.5. $TEST — Last Test Result 10.6. $X and $Y — Cursor Position 11. Routines and Program Structure 11.1. Routine Structure 11.2. Lines and Labels 11.3. Entry References 11.4. Command Abbreviations 12. Putting It All Together 13. Command Reference 13.1. BREAK 13.2. CLOSE 13.3. DO 13.4. ELSE 13.5. FOR 13.6. GOTO 13.7. HALT 13.8. HANG 13.9. IF 13.10. KILL 13.11. LOCK 13.12. OPEN 13.13. QUIT 13.14. READ 13.15. SET 13.16. USE 13.17. VIEW 13.18. WRITE 13.19. XECUTE 14. Function Reference 14.1. $ASCII 14.2. $CHAR 14.3. $DATA 14.4. $EXTRACT 14.5. $FIND 14.6. $JUSTIFY 14.7. $LENGTH 14.8. $NEXT 14.9. $PIECE 14.10. $RANDOM 14.11. $SELECT 14.12. $TEXT 15. Special Variables Reference 15.1. $HOROLOG 15.2. $IO 15.3. $JOB 15.4. $STORAGE 15.5. $TEST 15.6. $X 15.7. $Y 16. Operators Reference 16.1. Unary Operators 16.2. Binary Operators 17. Syntax Summary 17.1. Line Structure 17.2. Routine Structure 17.3. Name Syntax 17.4. Variable Syntax 17.5. Numeric Literal Syntax 17.6. String Literal Syntax 17.7. Entry Reference Syntax Appendix A: ASCII Code Table Appendix B: Glossary 18. What We Have Not Covered References 1. Introduction 1.1. What is MUMPS? 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.