MUMPS

from Wikipedia, the free encyclopedia

MUMPS ( M assachusetts General Hospital U tility M Ultimatum P rogramming S ystem ), or alternatively M is an originally on DEC PDP - and VAX Computer? Developed programming language (specifically, interpreted language , which itself Multitasking allows) with integrated database , which today is available for almost all common computer platforms.

MUMPS was developed in 1966 on the initiative of Octo Barnett. In 1977 the programming language of the same name contained in the programming system became MUMPS ANSI standard (ANSI / MDC X11.1-1977), in 1992 also ISO standard (ISO / IEC 11756). Around the same time, the term "M" or "M-Technologie" (or "M Technology" in the English-speaking world) is becoming more and more popular.

The programming system was originally mainly used for hospital applications. Applications from this period are typically programs that run on a terminal without the convenience of graphical user interfaces and without mouse support . At the time of its creation, MUMPS was superior to the competing programming languages ​​in many respects - mainly because of its multitasking and the use of limited system resources - and was soon used in other industries (e.g. retail, banking and logistics). Due to the extreme longevity of many corporate IT systems, for which a complete replacement is not only expensive but also very risky, numerous MUMPS systems are still operated and further developed today. In this respect it is very similar to COBOL .

Language syntax

As is usual with most common programming languages, a syntactic unit begins with a command or an instruction, usually followed by one or more parameters. Several syntactic units can be joined together in a command line by separating them with spaces. Comments within the program code are introduced with a semicolon. Strict left / right processing applies within a command line; this also applies to mathematical constructs. Point calculation before line calculation does not apply within MUMPS (2 + 3 * 10 = 50).

Variables have to be initialized within MUMPS but not declared and are valid within a program execution. Even calling a branching program does not change the validity of the variables. The programmer is solely responsible for organizing the validity.

One of the main strengths of the MUMPS programming language is the subscription and automatic sorting of variable arrays. This is available almost uniformly in the local, volatile area as well as in the global, non-volatile area. Since global variables are sorted and stored in so-called data files, MUMPS is also often referred to as a data storage system.

A key feature of the MUMPS programming language is the ability to use abbreviations for language syntax elements. While the advantages were definitely given in times of limited storage options, the use of this option led to the creation of program code that was difficult to read and therefore difficult to maintain. Since both local variables and syntactic elements can be named the same, MUMPS program code can in many cases only be read at all after intensive training and practice.

Further features of the MUMPS programming language are:

  • Post conditioning
  • Variable indirections
  • Execution of variable contents as program code
  • Minimal mathematical syntactic functionality
  • Multi-dimensional array tags
  • Pronounced pattern comparison
  • No different data types
  • Commands and instructions are not case sensitive

Program structure

Fixed rules apply to the program structure:

  • Each variable is treated as a character string and converted depending on the context.
  • A program line begins either with a statement / tag or a space or a TAB
  • An alphanumeric statement / tag must start with a letter
  • Statement / tags are separated from the code by a space or TABS. Spaces within an expression (e.g. x = 2 * 3) are not permitted, even if they can significantly improve readability in other languages.
  • The first line of a program must begin with a statement / tag which corresponds to the program name
  • Statements / tags are case sensitive, commands are case insensitive.
  • Statements / tags can be reached either absolutely or relatively
  • Jumps within a program are to be initiated with the command 'GO' or 'g'
  • As is common in most programming languages, statements / tags are declared using brackets for parameter transfer
  • Both single and multiple dot notation are possible within a program
  • Subprograms within a program can be called either as a program or / and as a function
  • MUMPS has no reserved expressions, while in other languages ​​it is forbidden ifto name a variable for example .

Schematic program structure

 Prog ;Erste Zeile des MUMPS-Programmes, der Programmname 'Prog' bildet das erste Statement / Tag
      ;... Programmcode ...
 Tag1 ;Statement / Tag, beeinflusst den Programmablauf nicht, dient ausschließlich als Sprungmarke
      ;... Programmcode ...
      do
      . ;Einfache Punktnotation
      . do
      .. ;Mehrfache Punktnotation
      . ;Zurück zur einfachen Punktnotation
      q  ;Programmende

 Tag2 ;Unterprogramm, wird nur ausgeführt wenn der Programmcode hierhin verzweigt
      ;... Programmcode ...
      q  ;Entweder Ende des Unterprogrammes oder Programmende, abhängig vom Aufruf des Unterprogrammes

 T3() ;Unterprogramm oder/und Funktion, abhängig vom Aufruf
      q  ;Ende des Unterprogrammes

 T4() ;Funktion, da das Funktionsende mit einem Rückgabewert definiert ist
      q "" ;Ende mit Wertrückgabe als Funktion

Sample code

This example comes from an application by the US Department of Veterans Affairs , which operates clinics for the medical care of former soldiers.

%DTC ; SF/XAK - DATE/TIME OPERATIONS ;1/16/92  11:36 AM
     ;;19.0;VA FileMan;;Jul 14, 1992
     D    I 'X1!'X2 S X="" Q
     S X=X1 D H S X1=%H,X=X2,X2=%Y+1 D H S X=X1-%H,%Y=%Y+1&X2
     K %H,X1,X2 Q
     ;
C    S X=X1 Q:'X  D H S %H=%H+X2 D YMD S:$P(X1,".",2) X=X_"."_$P(X1,".",2) K X1,X2 Q
S    S %=%#60/100+(%#3600\60)/100+(%\3600)/100 Q
     ;
H    I X<1410000 S %H=0,%Y=-1 Q
     S %Y=$E(X,1,3),%M=$E(X,4,5),%D=$E(X,6,7)
     S %T=$E(X_0,9,10)*60+$E(X_"000",11,12)*60+$E(X_"00000",13,14)
TOH  S %H=%M>2&'(%Y#4)+$P("^31^59^90^120^151^181^212^243^273^304^334","^",%M)+%D
     S %='%M!'%D,%Y=%Y-141,%H=%H+(%Y*365)+(%Y\4)-(%Y>59)+%,%Y=$S(%:-1,1:%H+4#7)
     K %M,%D,% Q
     ;
DOW  D H S Y=%Y K %H,%Y Q
DW   D H S Y=%Y,X=$P("SUN^MON^TUES^WEDNES^THURS^FRI^SATUR","^",Y+1)_"DAY"
     S:Y<0 X="" Q
7    S %=%H>21608+%H-.1,%Y=%\365.25+141,%=%#365.25\1
     S %D=%+306#(%Y#4=0+365)#153#61#31+1,%M=%-%D\29+1
     S X=%Y_"00"+%M_"00"+%D Q
     ;

Coding

The classic example

 write "Hello world",!

The same in short

 w "Hello world",!

Using the variable 'write', which is endowed with 'set'

 set write="Hello world"
 write write,!

The same in short form, 'set' is abbreviated with 's', 'write' is abbreviated with 'w'

 s w="Hello world"
 w w,!

Written on one line

 s w="Hello world" w w,!

Web links