Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z - Internet FAQ Archives

M Technology and MUMPS Language FAQ, Part 2/2

( Part1 - Part2 )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Forum ]
Archive-name: m-technology-faq/part2
Last-modified: 04/06/1998
Version: 1.9
Posting-Frequency: monthly

See reader questions & answers on this topic! - Help others by sharing your knowledge
M Technology and MUMPS Language FAQ

This FAQ is copyright 1997 by Gardner S. Trask III.  All rights reserved.
Permission is granted for this FAQ to be redistributed provided: 

    a) the redistribution is free, at no cost to the recipient;
    b) the redistribution includes the complete FAQ, without modification,
       including this notice;
    c) this FAQ is current, as determined by any of the following: it is
       less than 60 days old; or, it has been obtained directly from
       newsgroup comp.lang.mumps; or, you have queried the editor.

Post comments or suggestions to comp.lang.mumps or email to

Editors: Gardner Trask,
         Jon Diamond,


[M FAQ - Part 1 of 2]

1. What is M?
2. Where can I get a no-cost version of M?
3. What is comp.lang.mumps?  How can I subscribe to it?
4. What are some books about M?
5. What do M programmers love about M?
6. What things about M are generally disliked?
7. Why is M called a "database language?"
8. Is M an RDBMS?
9. Is M compiled or interpreted?
10. How fast is M?
11. Does M support Microsoft Windows and other GUIs?
12. Are there any M magazines or journals?
13. Which is the "official" name, M or MUMPS?
14. Is M a mainstream language?
15. Is M useful for non-medical applications?
16. Is M object-oriented?
17. Is M structured?
18. Is M suitable for multiuser systems?
19. Does M work on LANs?
20. Is M standard?
21. Is M portable?
22. How does M compare to SQL?
23. How does M compare to BASIC?
24. How does M compare to X-Base?
25. Are there M-based 4GLs and application generators?
26. Are there M bulletin boards? M FTP sites? M WEB sites? M Newsgroups?
27. "What happened in 1841?"
28. How do I list a global directory on this unfamiliar M system?
29. Do comments really affect efficiency?
30. What is the MDC?
31. A Brief History of M.
32. How exactly does $ORDER work?
33. M as a first computer language

[M FAQ - Part 2 of 2]
Appendix 1: List of M Vendors
Appendix 2: The M Technology Association
Appendix 3. USA Local M Users Groups
Appendix 4: Is the official name of the language "M" or "MUMPS?"
Appendix 5: A "secret decoder ring:" highlights of the M language
Appendix 6: An example of "textbook" M coding style
Appendix 7: An example of "traditional" M coding style
Appendix 8: Mumps, A Solution Looking For A Problem, By Chris Richardson
Appendix 9: Testimonials, Accolades, and Articles from outside the community.
Appendix 10: Contact information: e-mail and URL's
Appendix 11: FAQ Change history


Appendix 1: List of M Vendors

[1/08/95] InterSystems has acquired Digital's DSM product line.

Digital Equipment Corporation was formerly listed first (alphabetically) in 
this section. According to material published by InterSystems corporation on 
1/2/95, specifically the files dsmpr.txt, dsmqam.txt, and dsmlet.txt in 
their public FTP area, "Digital Equipment Corporation and InterSystems have 
formed a strategic partnership to expand the worldwide use of M Technology, 
particularly in the enterprise client/server arena.  Simultaneously, 
InterSystems has acquired the DSM software product line, Digital's 
implementation of M."  

"DSM will be marketed and sold by InterSystems' world-wide network of direct 
sales staff and distributors.  In addition, Digital will continue to sell 
DSM in Japan and to certain customers under existing multi-year contracts."

dsmqam.txt lists the following contacts for more information:

     Gerry Sunderland
     Digital Equipment Corporation
     151 Taylor Street  TAY1-1/B6
     Littleton, MA  01460-1407  USA
     Telephone: 508-952-4119

     Paul Schaut
     InterSystems Corporation
     One Memorial Drive
     Cambridge, MA 02142 USA
     Telephone: 617-621-0600
     Fax: 617-494-1631

Digital Equipment Corporation: see InterSystems corporation

Extensao Informatica e Tecnologia
Rua da Gloria 290/10 andar
20241 Rio de Janeiro RJ, Brazil
Phone: +55-21-224-9321
Fax: +55-21-224-6044
Contact: Luiz Carlos Lobo Filho

Greystone Technology Corporation
100 Unicorn Park Drave
Woburn, MA 01801-6707, USA
Phone: +1 617-637-9000
Fax: +1 617-937-9022
Contact: Chris Neikam

International Business Machines
1701 North St.
Mail Drop G98G Bldg 017
Endicott, NY 13760, USA
Phone: +1 607-752-5179
Contact: Frank Samuel
Also: Offices is most countries

InterSystems Corporation
One Memorial Drive
Cambridge, MA 02142
Phone: +1 617-621-0600
Fax: +1 617-494-1631
Contact: Maureen Flaherty
Also: Offices in UK, Germany

MGlobal International, Inc.
P.O. Box 459
Orange, TX 77631
Phone: +1 409-883-8537
Fax: +1 409-883-3721
Contact: David Brown

Micronetics Design Corporation
1375 Piccard Drive
Rockville, MD 20850, USA
Phone: +1 301-258-2605
Fax: +1 301-840-8943
WWW address:
Contact: Randy Crow, Janet Spadola, Aloysius Ring, John Streppa, Steve Obert
Also: Offices in UK, Germany, Australia, and distributors worldwide 

MUMPS Systems Laboratory
39-15 Daikan-cho
Higashi-ku, Nagoya, Japan
Phone: +81-52-936-5660
Fax: +81-52-935-5435
Contact: Ichiro Wakai, M.D

Patterson, Gray and Associates
1701 E. Woodfield Road
Suite 850
Schaumburg, IL 60173, USA
Phone: +1 708-619-7500
Fax: +1 708-619-7530
Contact: Jeffrey Shirk

PFCS Corporation
Post Office Box 1806
Manchester, MO 63011-8806, USA
Phone: +1 314-230-8847
Fax: +1 314-230-9897
Contact: Harlan Stenn

Rainergasse 1
A-1040 Vienna, Austria
Phone: +43-1-5055734
Fax: +43-1-5055734-34
Contact: Sandy R. Schorr

Appendix 2: The M Technology Association

For current pricing information, please contact the relevant group.

Membership for almost all MTAs includes:
 - M Computing (technical journal)
 - MTA's Annual Meeting (discount for members)
 - The MTA Publications Library (discount for members)
MTA-North America also provides
 - MSources (member, vendor, and business directory)
 - MTA's Job Referral Service
 - M Resource File
 - M Technology Association BBS

Other MTAs provide additional services. For example M Professional 
(technical journal from MTA-Europe).

M Technology Association 
1738 Elton Road, Suite 205 
Silver Spring, MD 20903-1725 
Phone: +1 301-431-4070 
Fax: +1 301-431-0017
Publication: M Computing

c/o datika nv
keerbergsesteenweg 19
B-3150 Haacht
phone : + 32 16 60 61 12
fax : + 32 16 60 61 17
e-mail :
Web page:

There are official MTA's/MUG's associated with MTA-Europe in Belgium, the
Netherlands, and Finland.  Spain and Italy have local groups who are not
officially associated with MTA-Europe.  And of course, UK+Ireland and
Germany have there own, realtively large groups, which are no longer
affiliated with MTA-E.

There are also reported MTAs in Brazil, Bulgaria, China, Czech/Slovak 
Republics, Germany, Ireland, Israel, Italy, Japan, and Russia.
Confirmation would be appreciated. 

Please contact either of the above addresses for current information.


Appendix 3. USA Local M Users Groups

 Baltimore-Washington MUG                    

 CONTACT: Susan Schluederberg                
 The Connections Group, Ltd.                 
 1100 Sunsett Drive
 Bel Air, MD 21014 
 Phone #: 410-838-6062                           
COSTAR Users' Group 
23715 W. Malibu Road
Malibu, CA 90265
Phone #: 310-456-9322

Chicago Area LUG                                
CONTACT: John Campbell on BBS         
Phone #: 312-929-6793                           

CONTACT: Mitch Bell
200 Rector Place, #9P
New York, NY 10280
Phone #: 212-657-3321                                                        

Central Florida MUG                              
213 East Bay Street 
Winter Gardens, FL 34787                    
CONTACT: Mike Minor 
         Mark Gerszewski                    
Phone #: 407-656-4990                       

Delaware Valley MUG
CONTACT: D-V MUG Coordinator
P.O. Box 323
Reading, PA 19607-0323                                                  
Phone: 215-748-2145

MUMPS of Georgia (MGA)
8351 Roswell Road  Suite 221
Atlanta, Georgia 30350
Secretary's phone: 1.770.968.3715

La MUG (Los Angeles)
Contact: Steve Atlas
5408 Rozie Ave.
Woodland Hills, CA 91367
Phone #: 818-883-1206

Minnesota M Users' Group                    
(Minneapolis-St. Paul) 
CONTACT: Chris Hawkins 
P.O. Box 14486 
Minneapolis, MN 55414            
Phone #: 612-627-6166               

New England MUG (Boston)
CONTACT: Gardner Trask 508-927-7637
7 Galloupe Avenue
Beverly, MA. 01915

Pacific Northwest MUG                           
CONTACT: Arden Forrey                       
Health Info. Admin. Program 
Dept. of Health Services                        
School of Public Health and                      
Community Medicine                               
1107 NE 45th St., #355
Seattle, WA 98105
Phone #: 206-543-8810                 

Pittsburgh Regional MUG
CONTACT: Bill Harvey
Computer Information Systems
Robert Morris College
600 5th Ave.
Pittsburgh, PA 15219-3099
Phone #: 412-262-8467

San Francisco Area MUG 
CONTACT: Julie Dijailia                          
51 Ridgewood Ave.                                
San Francisco, CA 94112                              
Phone #: 415-262-8467                            
Southwest MUG (Dallas-Fort Worth)
CONTACTS: Carol Anzaldua, Peter Flores
1901 North Highway 360, #351
Grand Prairie, TX 75050
Phone: 817-633-3944

Sunshine MUG                                    
(Southern Florida)                               
CONTACT: Mark Fedora                        
Phone #: 305-882-5319                            
Eastern Financial Credit Union 
700 South Poinciana Blvd.              
Miami Springs, FL 33166                
CONTACT: Rob Atlas                     
Phone #: 407-394-5888                  

Tri-State LUG (New York)
CONTACT: Mitch Bell
200 Rector Place, #9P
New York, NY 10280
Phone #: 212-657-3321


Appendix 4: Is the official name of the language "M" or "MUMPS?"

This is the M community's very own little religious war. Not everyone 
prefers the name M.  Many feel strongly about the issue. Ed de Moel says 
that "within the M[UMPS] community, there is a strong sentiment that MUMPS 
is not the right name for the language; there is an (equally?) strong 
sentiment that MUMPS is a better name than any of the proposed 

All of the following opinions can and have been supported:

     The name became M in 1993.
     The name will become M when the new ANSI standard is adopted.
     Both M and MUMPS are officially accepted names.
     M is only an "alternate name" or "nickname" for the language.

The following samples show the diversity of opinions.  I have given Ed de 
Moel, a member of the MUMPS Development Committee, the last word.  (However, 
it is possible to find other views within the MDC membership).


I'm curious as to how long it will take "M" to fully replace "MUMPS". I was 
disappointed that [comp.lang.mumps] wasn't created with that name.

     [Russell Haddleton]

The name of the language is MUMPS.  'M Technology' is a marketing ploy that 
ignores the language; what it's called doesn't change what it IS. (The MDC 
has NOT changed the name of the language as far as I know -- they permitted 
M as an alternate name)

     [Ben Bishop]

The name of the group should be comp.lang.m. I understand the issue of 
"grep'ing" on M prohibitive, but I can't see throwing out all the hard work 
of the MTA. M is the name.

     [Gardner Trask]

DSM stands for Digital Standard M now. In recent advertising DataTree refers 
to their product as DataTree M.

I thought the official name of the language was M too, but this is not the 
case. The primary name for the language is still MUMPS.  The ANSI standard 
refers to the language as MUMPS with M as an alternate name.  The M 
Technology Association decided to use M as the primary _reference_ to the 
language MUMPS.

     [Doug Preiser]

> Can anyone think of something you can do in some other language
> that you can't do in MUMPS ?

Well, let's try using 'M' instead of MUMPS for a start, before any
XJ-11 people start flaming. 

     [Richard Nason]

M is a well-accepted nickname for a programming language called MUMPS. 
MUMPS, in turn, is an acronym that stands for Massachusetts (General 
Hospital) Utility Multi Programming System.

MUMPS is a language that goes by many names. Since a number of years, there 
has been a strong movement to change the name of the language to something 
else than MUMPS, countered by an equally strong movement to keep the name as 
is was.

The first official request to change the name of the language to "M" was in 
1980, when Terry Ragon (now president of InterSystems) wrote a letter to the 
MUMPS Development Committee, requesting this change. At that moment in time, 
it was decided to keep the name MUMPS, but the movement to change the name 
did not disappear.

Over the years, there has been a number of informal requests to change the 
name of the language, but, oddly, there never was a formal proposal to do 
this before the MUMPS Development Committee (the only body that can change 
the name of the language).

The only thing that happened officially was that the nickname "M" became 
accepted as an alternate name. The language is still officially called 
MUMPS. Other official designations are ANSI X11.1 (1990) and ISO 11756 

Several of the user's groups have adopted the nickname, and changed their 
name to reflect that adoption, so we now have a MTA (USA), MTA-Japan, MTA-
Europe, but Germany uses MUG-Deutschland (M Users Group) and Soyuz-DIAMS in 

The most recent formal resolution that was passed by the MUMPS Development 
Committee regarding the name was to use the nickname throughout the document 
that is currently being circulated through the canvass process as the new 
draft ANSI standard.  Evidently, this strongly promotes the use of the 
nickname over the 'real' name, but it still doesn't change the name of the 

Maybe one day, someone will submit a formal proposal to the MUMPS 
Development Committee, but until such a proposal is submitted and favourably 
voted upon, "M" will remain a (well accepted) nickname for MUMPS.

     [Ed de Moel]

Appendix 5: A "secret decoder ring:" highlights of the M language

This incomplete, informal sketch seeks to give programmers familiar with 
other languages a feeling for what M is like.  It doesn't tell you enough to 
write M code; it may help you to read it.  Neither the language description 
and the descriptions of each feature are complete, and many very significant 
features have been omitted for brevity.

DATA TYPES: one universal datatype, interpreted/converted to string, 
integer, or floating-point number as context requires. Like Visual BASIC 
"variant" type.

BOOLEANS: In IF statements and other conditionals, any nonzero value is 
treated as True.  a<b yields 1 if a is less than b, 0 otherwise.

DECLARATIONS: NONE. Everything dynamically created on first reference.

LINES: important synactic entities. Multiple statements per line are 
idiomatic. Scope of IF and FOR is "remainder of current line."  

CASE SENSITIVITY: Commands and intrinsic functions are case-insensitive.  
Variable names and labels are case-sensitive.  No specified meaning for 
upper vs. lower-case and no widely accepted conventions.  Percent sign (%) 
is legal as first character of variables and labels. 

POSTCONDITIONALS: SET:N<10 A="FOO"  sets A to "FOO" if N is less than 10; 
DO:N>100 PRINTERR performs PRINTERR if N is greater than 100. Provides a 
conditional whose scope is less than the full line.

ARRAYS: created dynamically, stored sparsely as B-trees, any number of 
subscripts, subscripts can be strings or integers. Always automatically 
stored in sorted order. $ORDER and $QUERY functions allow traversal.

     for i=10000:1:12345 set sqtable(i)=i*i
     set address("Smith","Daniel")=""

LOCAL ARRAYS: names not beginning with caret; stored in process space; 
private to your process; expire when process terminates; available storage 
depends on partition size but is typically small (32K)

GLOBAL ARRAYS: ^abc, ^def. Stored on disk, available to all processes, 
persist when process terminates. Very large globals (hundreds of megabytes) 
are practical and efficient. This is M's main "database" mechanism. Used 
instead of files for internal, machine-readable recordkeeping.

INDIRECTION: in many contexts, @VBL can be used and effectively substitutes 
the contents of VBL into the statement. SET XYZ="ABC" SET @XYZ=123 sets the 
variable ABC to 123. SET SUBROU="REPORT" DO @SUBROU performs the subroutine 
named REPORT. Operational equivalent of "pointers" in other languages.    

PIECE FUNCTION: Treats variables as broken into pieces by a separator. 
$PIECE(STRINGVAR,"^",3) means the "third caret-separated piece of 
STRINGVAR." Can appear as an assignment target. After 

    SET X="" 

$PIECE("",".",2) yields "std".  SET $P(X,"@",1)="office" causes 
X to become "".

     Set stuff(6)="xyz",stuff(10)=26,stuff(15)=""  

$Order(stuff("")) yields 6, $Order(stuff(6)) yields 10, $Order(stuff(8)) 
yields 10, $Order(stuff(10)) yields 15, $Order(stuff(15)) yields "". 

     Set i="" For  Set i=$O(stuff(i)) Quit:i=""  Write !,i,?10,stuff(i)

The argumentless For iterates until stopped by the Quit.  Prints a table of 
i and stuff(i) where i is successively 6, 10, and 15. 

COMMANDS: may be abbreviated to one letter, case-insensitive.

   DO XYZ                        call subroutine at label XYZ
   DO PQR(arg1,arg2,arg3)        call with parameter passing
   ELSE  stmnt1 stmnt2 stmnt3    opposite of last IF
   FOR  stmnt1 stmnt2 stmnt3     repeat until a QUIT breaks you out
   FOR i=1:1:100 stmnt1 ...      iteration, i=1, 2, 3, ... 100
   GOTO                          yes, there is one
   IF cnd stmnt1 stmnt2 stmnt3   conditionally execute rest of line 
   KILL vbl                      return vbl to "undefined" state
   NEW vbl1,vbl2,vbl3            stack old values, create fresh
                                 "undefined" state. Pop on QUIT.
   QUIT                          return from subroutine
   QUIT value                    return from extrinsic function
   READ "Prompt:",x              on current I/O stream, first write
                                 "Prompt:", then read line into variable x  
   SET a=22,name="Dan",(c,d)=0   variable assignment
   USE 23                        switch I/O stream to device 23
   WRITE !,"x=",x                output to current I/O stream. ! = new line
   XECUTE("set a=5 do xyz")      execute arbitrary data as M code

OPERATORS:  No precedence, executed left to right, parenthesize as desired. 
2+3*10 yields 50.
   +  -  *  /                  sum, difference, product, quotient
   \                           integer division, 1234\10 yields 123
   #                           modulo
   _                           concatenation, "nice"_2_"use" --> "nice2use"
   & ! ' <  >                  and, or, not, less, greater, equal
   [                           string contains.  "ABCD"["BC" --> 1
   ]                           string lexically follows. "Z"]"A" --> 1
   ?                           pattern match operator


Important structural components of the language (not commonly
found in other languages):

   $DATA(V)                    tests if a V is defined (has data) or not
   $ORDER, $QUERY              traverse arrays in sorted order
   $ORDER(a("abc"))            value v is the next subscript, following
                               "abc", according to the M collating sequence,
                               such that a(v) is defined.                   
   $PIECE                      see above
   $SELECT(c1:v1,c2:v2,1:v3)   if c1 is true yields v1, else if c2 is true
                               yields v2, otherwise yields v3          
   $TEXT(FOO+3)                returns text of source code at line FOO+3

Convenience functions similar to library functions in other languages:

   $ASCII, $CHAR               text-to-ASCII-code and inverse
   $EXTRACT(string,5,10)       characters 5 through 10 of string; may be
                               assignment target
   $FIND(string,find,from)     substring search
   $FNUMBER                    floating point formatting
   $LENGTH(string)             just what you think
   $RANDOM(100)                random # in range 0 to 99 inclusive
   $TRANSLATE("abcd","ab","AB") character substitution; yields "ABcd"

Appendix 6: An example of "textbook" M coding style

This is based on an example from a well-known M textbook, "The Complete 
MUMPS" by John Lewkowicz.  It shows how M can support a "modern" appearance 
and coding style.  See notes below for more detail.  Lines are numbered for 
reference only; the line numbers are NOT part of the M code.     

 1 zsample ;dpb;09:18 PM  6 Aug 1994
 3         ;Test the Stats routine:        
 4         ;Calculate 1000 points w. approx. Gaussian distribution,
 5         ;then call Stats on the result
 6         ;Execution time: 5 seconds with DTM on a 33 MHz 386DX
 8         New Data,i,j,output
 9         For i=1:1:1000 Set Data(i)=$$Normal
10         Do Stats("Data",.output)
11         Write !,output
12         Quit
14         ;------------------------------------------------------------
15         ;Based on Lewkowicz, "The Complete MUMPS," examples 9.15-9.17
16         ;Modified slightly:
17         ;Used argumentless Do instead of two If's for Num>1 block
18         ;Corrected calculation of the standard error
19         ;------------------------------------------------------------
21 Stats(Ref,Results) ; Calculate simple Statistics on Array nodes
22         New High,i,Low,Mean,Num,StdDev,StdErr,s,Sum,SumSQ,Var
23         Set High=-1E25,Low=1E25,(Sum,SumSQ,Num)=0,s=""
24         For  Set s=$O(@Ref@(s)) Q:s=""  Do StatsV(@Ref@(s))
25         If 'Num Set Results="" Goto StatsX
26         Set Mean=Sum/Num
27         Set (StdDev,StdErr,Var)=""
28         If Num>1 Do
29         . Set Var=-Num*Mean*Mean+SumSQ/(Num-1)
30         . Set StdDev=$$SQroot(Var)
31         . Set StdErr=StdDev/$$SQroot(Num)
32         Set Results=Num_";"_Low_";"_High_";"_Mean
33         Set Results=Results_";"_Var_";"_StdDev_";"_StdErr
34         Goto StatsX
35 StatsV(Val) ;Process an individual value
36           Set Val=$$NumChk(Val) Quit:Val=""
37          Set Num=Num+1,Sum=Sum+Val,SumSQ=Val*Val+SumSQ
38          Set:Val<Low Low=Val Set:Val>High High=Val
39          Quit
40 StatsX   Quit
42 SQroot(Num) ;Return the SQUARE ROOT of abs(Num)
43         New prec,Root Set Root=0 Goto SQrootX:Num=0
44         Set:Num<0 Num=-Num Set Root=$S(Num>1:Num\1,1:1/Num)
45         Set Root=$E(Root,1,$L(Root)+1\2) Set:Num'>1 Root=1/Root
46         For prec=1:1:6 Set Root=Num/Root+Root*.5
47 SQrootX      Quit Root
49 NumChk(Data,Range,Dec) ;Check for valid NUMBER
50         Set Data=$TR(Data,"+ $,")
51         Goto NumChkE:Data'?.E1N.E,NumChkE:Data'?."-".N.".".N
52         If $D(Dec),Dec?1N.N g NumChkE:$L($P(Data,".",2))>Dec
53         Set:'$D(Range) Range="" Set:Range="" Range="-1E25:1E25"
54         If $P(Range,":")'="" Goto NumChkE:Data<$P(Range,":")
55         If $P(Range,":",2)'="" Goto NumChkE:Data>$P(Range,":",2)
56         Set Data=+Data Goto NumChkX
57 NumChkE      Set Data=""
58 NumChkX Quit Data
59      ;
60      ;------------------------------------------------------------------
61      ;
62      ;Part of demo/test code, Dan Smith, 8/26/94
63 Normal() ;Return random # with approximately Gaussian distribution
64         New i,x,n ;n=# iterations
65         Set x=0,n=3 ;Higher n = slower, better Gaussian approximation
66         ;$random(1201) has approx. mean=600, variance=120000
67         For i=1:1:n*n Set x=x+$random(1201)-600
68         Set x=x/(346.4101615*n) ;variance now 1
69         Quit x

[Lines 21-58 are from Examples 9.15, 9.17 and 9.18 of "The Complete MUMPS," 
by John Lewkowicz, ISBN 0-13-162141-6, 1989, Prentice-Hall, Englewood Cliff, 
New Jersey and are copyright 1989 by Prentice-Hall, Inc.  Permission to use 
these examples has been solicited from Prentice-Hall, but no reply has been 
received.  This Appendix may be modified or omitted in future versions if 
Prentice-Hall objects to its inclusion].


Line 8:

Command names: Command names in M are case-insensitive, and may either be 
spelled out in full or abbreviated to a single character.  Thus, the NEW 
command could be written as "NEW" or "New" or "new" or "N" or "n".  
Lewkowicz consistently spells them out in full, with mixed case.

NEW command: This is not a declaration, but an executable command.  In M, 
this is the way you effectively make a variable private to a subroutine.  On 
entry to zsample, the variables Data, i, j, and output may or may not have 
values.  The New command stacks the old identity of these variables, which 
now become undefined.  zsample may freely use the variables.  On Quit-ing 
from the subroutine, any values the subroutine established for them are 
discarded and the old values restored.

It is good practice to New the variables used for temporary storage within a 
subroutine, and some programmers do this systematically.  Lewkowicz does it, 
and alphabetizes the order of the names in the New list to make maintenance 

Lines 8, 10, and 21: Passing an array reference as an argument.  "Stats"
is a subroutine which takes a parameter list.  It is designed to work 
generally using any array, local or global, or array reference.  The 
argument that is passed is a string; here, the string "Data", which names a 
local array.  Within the subroutine, the "subscript indirection" mechanism 
is used; i.e. because Ref has been set equal to the string "Data", the 
expression @Ref@(s) refers to Data(s). If Ref were set to "^Permanent", the 
expression @Ref@(s) would refer to ^Permanent(s).  Ref could also be set to 
an array subnode.

Line 28: An "argumentless DO."  This structure causes the set of lines 
beginning with periods to be executed.  Argumentless "DO's" can be nested.  
They stack and restore the value of $T.  Using these tools it is possible to 
write nested "If-Else" structures that behave as expected. 

    If condition1 Do
    . If condition2 Do
    . . <code> ;executes if condition1 and 2 are both true
    . . <code>
    . . <code>
    . Else  Do
    . . <code> ;executes if condition1 is true but not condition2
    . . <code>
    . . <code>
    Else  Do
    . <code> ;executes if condition1 is false
    . <code>
    . <code>

Appendix 7: An example of "traditional" M coding style

     ;;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)
     S %='%M!'%D,%Y=%Y-141,%H=%H+(%Y*365)+(%Y\4)-(%Y>59)+%,%Y=$S(%:-
     K %M,%D,% Q
DOW  D H S Y=%Y K %H,%Y Q
     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
YMD  D 7 S %=$P(%H,",",2) D S K %D,%M,%Y Q
T    F %=1:1 S Y=$E(X,%) Q:"+-"[Y  G 1^%DT:$E("TODAY",%)'=Y
     S X=$E(X,%+1,99) G PM:Y="" I +X'=X D DMW S X=%
     G:'X 1^%DT
PM   S @("%H=$H"_Y_X) D TT G 1^%DT:%I(3)'?3N,D^%DT
N    F %=2:1 S Y=$E(X,%) Q:"+-"[Y  G 1^%DT:$E("NOW",%)'=Y
     I Y="" S %H=$H G RT
     S X=$E(X,%+1,99)
     I X?1.N1"H" S X=X*3600,%H=$H,@("X=$P(%H,"","",2)"_Y_X),%=$S(X<0:-
1,1:0)+(X\86400),X=X#86400,%H=$P(%H,",")+%_","_X G RT
     D DMW G 1^%DT:'% S @("%H=$H"_Y_%),%H=%H_","_$P($H,",",2)
RT   D TT S %=$P(%H,",",2) D S S %=X_% I %DT'["S" S %=+$E(%,1,12)
     Q:'$D(%(0))  S Y=% G E^%DT
PF   S %H=$H D YMD S %(9)=X,X=%DT["F"*2-1 I @("%I(1)*100+%I(2)"_$E("> 
<",X+2)_"$E(%(9),4,7)") S %I(3)=%I(3)+X
TT   D 7 S %I(1)=%M,%I(2)=%D,%I(3)=%Y K %M,%D,%Y Q
NOW  S %H=$H,%H=$S($P(%H,",",2):%H,1:%H-1)
     D TT S %=$P(%H,",",2) D S S %=X_$S(%:%,1:.24) Q
DMW  S %=$S(X?1.N1"D":+X,X?1.N1"W":X*7,X?1.N1"M":X*30,+X=X:X,1:0)
COMMA     ;
     S %D=X<0 S:%D X=-X S %=$S($D(X2):+X2,1:2),X=$J(X,1,%),%=$L(X)-3-
     F %=%:-3 Q:$E(X,%)=""  S X=$E(X,1,%)_","_$E(X,%+1,99)
     S:$D(X2) X=$E("$",X2["$")_X S X=$J($E("(",%D)_X_$E(" )",%D+1),%L) K 
HELP S DDH=$S($D(DDH):DDH,1:0),A1="Examples of Valid Dates:" D %
     S A1="  JAN 20 1957 or 20 JAN 57 or 1/20/57"_$S(%DT'["N":" or 
012057",1:"") D %
     S A1="  T   (for TODAY),  T+1 (for TOMORROW),  T+2,  T+7,  etc." D %
     S A1="  T-1 (for YESTERDAY),  T-3W (for 3 WEEKS AGO), etc." D %
     S A1="If the year is omitted, the computer "_$S(%DT["P":"assumes a 
date in the PAST.",1:"uses the CURRENT YEAR.") D %
     I %DT'["X" S A1="You may omit the precise day, as:  JAN, 1957" D %
     I %DT'["T",%DT'["R" G 0
     S A1="If the date is omitted, the current date is assumed." D %
     S A1="Follow the date with a time, such as JAN 20@10, T@10AM, 10:30, 
etc." D %
     S A1="You may enter a time, such as NOON, MIDNIGHT or NOW." D %
     I %DT["S" S A1="Seconds may be entered as 10:30:30 or 103030AM." D %
     I %DT["R" S A1="Time is REQUIRED in this response." D %
0    Q:'$D(%DT(0))
     S A1=" " D % S A1="Enter a date which is "_$S(%DT(0)["-
":"less",1:"greater")_" than or equal to " D %
     S Y=$S(%DT(0)["-":$P(%DT(0),"-",2),1:%DT(0)) D DD^%DT:Y'["NOW"
     I '$D(DDS) W Y,"." K A1 Q
     S DDH(DDH,"T")=DDH(DDH,"T")_Y_"." K A1 Q
%    I '$D(DDS) W !,"     ",A1 Q
     S DDH=DDH+1,DDH(DDH,"T")="     "_A1 Q

[NOTE: this example is extracted from VA FileMan Version 19.0.  There is no 
copyright notice in the text of the source code or any of the accompanying 
documents; FMANPROG.TXT and FMANUSER.TXT each specifically contain the 
statement "VA FileMan is a public domain software package that is developed 
and maintained by the Department of Veterans Affairs."  I therefore believe 
no permission is required to reproduce this passage.--Daniel P. B. Smith]

1) The "New" command is not used; all variables are treated as universal in 

2) There is no use of the DO parameter passing mechanism, and no use of 
extrinsic functions.  Information is passed in and out of subroutines by 
setting variables.  

Practices 1 and 2 make it difficult to understand which variables are used 
for input, which for output, and which are for temporary local processing 
(and could just as well be private to the routine).  They also make it 
difficult to add new code to a project because of the possibility of 
variable name conflicts.  

3) M commands are uniformly abbreviated to a single character.

4) Variable names are short, frequently a single character.  The single 
percent sign is used as a variable name, and also as an array.

5) Labels are short.  Some label consist of single characters or even single 
numerals.  The percent sign is used as a label. 

Practices 3, 4, and 5 make the code difficult to read for novices, but are 
much less of a problem for experienced M programmers.  

It can be argued practice 3 is beneficial because it aids in visual 
identification of "argumentless" commands.  In M, "argumentless" commands 
("Do", "Quit", "For") are semantically different from same commands with 
arguments ("Do REPORT","Quit retvalue", "For I=1:1:100").  Unfortunately, 
the M whitespace rules say that a command and its arguments must be 
separated by precisely one space, and an "argumentless" command is 
identified by being followed by two or more spaces.

6) Some lines are considerably in excess of 80 characters and wrap
when displayed or printed. 

Line scope is significant in M; "For" and "If" operate on the rest of the 
current line.  Multistatement lines are natural to M, and M permits lines to 
be up to 255 characters long.  When the natural logic of a statement calls 
for more than eighty characters, the programmer can choose to write a long 
line, or rework the logic to avoid this.  The argumentless DO and block 
structure make this easy to do; for example

     I X?1.N1"H" S X=X*3600,%H=$H,@("X=$P(%H,"","",2)"_Y_X),%=$S(X<0:-
1,1:0)+(X\86400),X=X#86400,%H=$P(%H,",")+%_","_X G RT

      can be rewritten as

     If X?1.N1"H" Do  Go RT
      . Set X=X*3600,%H=$H,@("X=$P(%H,"","",2)"_Y_X)
     . Set %=$S(X<0:1,1:0)+(X\86400)
     . Set X=X#86400,%H=$P(%H,",")+%_","_X

However, some programmers see no need for this, and just as there are syntax 
purists, there are efficiency purists who will point out that the rewritten 
version must take at least some additional execution time and must consume 
at least some additional program space.

7) There are eleven goto (G) statements.  Note that six of them
transfer control to labels in routines other than %DTC itself.

8) The only uses of comments are the two heading lines, and in blank
lines used to separate subroutines for readability.

Appendix 8: Mumps, A Solution Looking For A Problem, By Chris Richardson

This article on MUMPS appeared in an old issue of a computer newsletter:
Mumps, A Solution Looking For A Problem
By Chris Richardson
(Copyright (c) 1993 Personal Systems, the monthly journal of the San
Diego Computer Society; all rights reserved. Permission to reproduce
this article is granted to other non-profit organizations such as
computer user groups for non-commercial use as long as credit to the
author and group is given and provided a copy of the newsletter is 
sent to us at: San Diego Computer Society, ATTN: Editor, Personal
Systems; 5694 Mission Center Road; Suite 602, Box 350; San Diego, CA
What is MUMPS?  Is it a programming language that thinks it is a
database, or is it a database that thinks it is a programming
language?  Actually, it is both.  And it is an ANSI Standard Language
to boot.  
What does that mean to anyone who is knocking out little
applications on a home PC or Apple?  Well, the nice thing about an
ANSI Standard language is that the code you write on the Apple in
standard MUMPS transports nicely to the IBM PC without any change. 
And if that other system is a mainframe, like a Vax or a large IBM
system, your application will work there also.
Where did MUMPS come from and what does MUMPS stand for?  MUMPS was
originally developed in the middle 60's on a National Institute of
Health Grant at Massachusetts General Hospital.  It was originally
designed to run on a large machine (at that time...) 4K of memory
(that is 4,000 bytes, not megabytes) and 100 megabyte disk storage.  
If it was written by a hospital, does it only do hospital problems? 
It was designed to solve the problem of tracking patient data.  How
does patient data differ from auto supply inventory or a check book? 
A patient can have many attributes that describe each encounter.  For
instance, suppose a patient gets admitted to a hospital with a
traditional square record database, and is known to have six 
allergies, but there is only room for five allergies in the record.
Which allergy will you elect not to record?  If this patient dies
because of that one allergy that you did not record, your hospital may
change ownership in settling his estate.  For the majority of
patients, the space reserved for the five allergies will not be used
and is wasted space.  That means that your hospital will be buying
more disk space a lot sooner.
In the MUMPS environment, the database disk space is not allocated
until it is needed (run-time).  This means that the patient record
expands to fit the amount of data required for that patient.  If the
space is not used, it is not allocated.  If you have 12 patients in
your database, you have only the space for these 12 records allocated. 
In most traditional databases, you must allocate as many records as you 
expect before the first record is allocated.  With MUMPS, many databases can 
be described but they will not take up any space until actual records are 
created.  There is no theoretic maximum number of records that a specific 
database can contain.  It is only bound by the actual amount of disk space 
that is available to be assigned.  Talk about getting 10 pounds in a 5 pound 
Many database environments already exist for the PC, why should you be 
interested in another?  MUMPS is unlike most other databases in that it is 
also a special type of programming language called an interpreter.  OK, we 
hear the moans from the BASIC programming crowd. And did you think you got
rid of interpreters when BASIC compilers came out.  Well, you didn't.  
Interpreters don't have to be slow and most database environments actually 
do go interpretive when they service user queries.  Anyway, even if
the MUMPS interpreter was slow (which it isn't) the levels of run-time 
and error-time support is worth the difference.  
When a MUMPS application stops for some reason, the symbol table remains 
intact at the line of code being executed when the error occurred.  
In the event of an error, control may be passed to another routine to capture 
the conditions of the failure or even attempt to recover from the error
condition.  Traditionally, MUMPS database applications have a short 
mean-time-to-repair (MTTR) of just a few minutes and a long up-time record.   
Also, in many cases, the application that blew up can be re-started from 
where it left off. 

What does MUMPS look like? 
MUMPS has only a single data type, strings (of characters).  This makes the 
conversion from one data type to another easier. Most MUMPS commands may be abbreviated to a single character.  Or spell them out if you choose.  Code generation is quick.
MUMPS commands can be easily combined to form more complex and complicated 
structures.  Each line of code is a block of code. MUMPS makes little distinction between data and code.  Code can be created and executed from a database or the symbol table at run-time.  Data can be stored in a routine and accessed at run-time.
MUMPS is a sparse matrix array processor.  This means that arrays are allocated at run-time; the arrays may be created in any order.  Array 
element 1000000 can be created and then element 2 can be created and yet the 
array only has 2 elements in it.
Because there are only string data types, the subscripts of a MUMPS array are 
strings.  What a concept!  You can subscript an array by "APPLES" and 
"ORANGES", and "AVOCADOS".  Now for the good news, when those subscripts are 
created, they are sorted alphabetically.  MUMPS means never having to say 
you're sorting.
The language is still growing.  Every ANSI Standard has a built-in sunset of 
seven years.  That means that if nothing is done with a standard in seven 
years, it ceases to be a standard.  Well, MUMPS has had an ANSI standard for 
1977, 1984, 1990, and the MUMPS Development Committee is attempting to 
release a 1993 standard.  Additional standards for WINDOWING, Networking, 
and Transaction Processing are currently in process.
MUMPS is transportable.  It doesn't matter if MUMPS code is running under 
MS-DOS, Windows NT, UNIX, VMS, VM, or nearly any operating system you might 
mention, the code and database will still run.  In fact, in some 
implementations MUMPS is also the operating system.
Who uses MUMPS?  Probably a lot more than you might think.  How about
the Veteran's Administration.  Well, the VA did such a good job of
putting a Fourth Generation Language together in MUMPS that the Indian
Health Service decided to use it, then the U. S. Public Health
Service, and finally the Department of Defense for the Army, Navy, and
Air Force hospitals and clinics around the world.  By the way, the 
VA's 4GL, File Manager is in the public domain.  If you can find a
source, you can get it free!  Another advantage is that the package is
distributed as source code because MUMPS is an interpreter.
Is it just for hospitals?  No, MUMPS is an excellent choice for nearly
any database operation, especially if not every aspect of the
situation is known.  MUMPS is being used by banks and credit unions. 
Do you travel on airlines?  You have probably been scheduled on a
MUMPS system.  All of the postage stamp sales for the U.S. Postal
Service are tallied on a MUMPS system each evening.  Auto parts houses
keep track of their inventories with MUMPS systems. Language
translators have been implemented in MUMPS and it also works
well with artificial intelligence projects.
If MUMPS was developed here, is it only used in this country?  The
national health services of Finland and England, as well as a few
other countries are currently using MUMPS.  Ever gamble in the
gambling houses in London?  They use MUMPS to track high rollers from
one gambling house to the next.  The British Stock Exchange also uses
MUMPS.  The largest department store chain in Spain uses MUMPS.  The
Russians acquired a copy of MUMPS and modified it to run their 
national health services and track containerized freight.
If MUMPS is so good, why haven't I heard of it?  This is an
interesting point.  The computer industry lives on some very simple
rules, 1) sell products with follow-on (things that need other things
to work properly or better) and 2) sell items that make it difficult
to migrate to another vendor's hardware or software (also known as
product loyalty).  MUMPS provides the programming language,
the database, the screen handler, and soon, windows of any platform
that will have a MUMPS interpreter (which is just about any platform). 
MUMPS code is extremely transportable.  Standard MUMPS code works fine
on whatever platform you run it on.
When a MUMPS implementation is installed to replace an existing
traditional system, usually there are sufficient resources for the
MUMPS environment, with plenty of resources left for future expansion.
Alright, I'm sold.  Where can I get MUMPS for my system?  Now for some
good news, there is an evaluation version of MUMPS for MS-DOS that is
free, especially if you happen to be a student.  The vendor only asks
that you register your use of the product.  
By the way, there is extensive documentation available for this
product.  There is a MUMPS Users' Group (now called the M Technology
Association) which can be contacted at:

MUMPS Users' Group of North America
1738 Elton Road, Suite 205
Silver Spring, MD 20903
Phone: (301)-431-4070
Fax:   (301)-431-0017

(Author Profile:  Chris Richardson is a Software Engineer with Science
Applications International Corporation in San Diego and is a member of
the MUMPS Development Committee, the ANSI Standards writing
organization for the MUMPS language.  He has worked for NASA, the U.
S. Public Health Service, the U. S. Navy, Army, and the Air Force as
well as Computer Sciences Corporation and Singer-Link in Houston.  He
has taught Real-time FORTRAN and MUMPS to professionals in the 
industry and government).


Appendix 9: Testimonials, Accolades, and Articles from outside the community.

This section is dedicated to mentioning articles, white papers, research, 
et al that is no produced by the M Community, but by someone in the "Real 
World". I will accept submissions of articles, pointers, etc. for 
published matertials (electronic or physical) as of 1/1/96 on.

Older submissions may be included if they are of a unique, or highly 
informative nature.

I. Computer Language Rating Table:

Source:	Newsgroups: comp.lang.mumps
Date: Mon, 7 Oct 1996 09:06:20 -0500

>>> Try looking at  It contains a
>>> language ranking, based on the amount of effort required to code a
>>> function point and M ranks very well.

II. ?


Appendix 10: Contact information: E-mail and URL addresses:

This document contains url's and addresses that were acurate at the 
time of the original inclusion. URL's and e-mail addresses change
however, and will (when notified) be reflected in Appendix 10.
So, if you wish to reach a contributor, confirm addresses there.

Ellis A. Bauman, <>
Ben Bishop,
Dennis J Brevik, <>
Steve Clay, <>
Etienne Cherdlu, <>
Floyd Dennis, <>
Jon Diamond <>
Rod Dorman, <>
John D. Godfrey,
Gavin Greig,
Russell Haddleton, rfh2y@uvacs.cs.Virginia.EDU
Brett Hunt,
Lev Jacob, lev@TRENDLINE.CO.IL
Scott P. Jones, scott@INTERSYS.COM
John E. Kemker, III,
Mark Komarinski,
Monika Kratzmann, <monika@INTERSYS.COM>
Jeff Loeb, 
Keith F. Lynch,
Jim McIntosh, <>
Ed de Moel,
Steve J. Morris,
Kevin O'Gorman, kevin@kosman.uucp
Paul Perrin, <>
Doug Preiser,
Harold Pritchett, <harold@UGA.CC.UGA.EDU>
Aaron Seidman,
Kate Schell,,
Tilman Schmidt,
Arthur B. Smith,
Daniel P. B. Smith, <>
Richard J. Tomlinson,
Gardner Trask,
David Whitten,


Appendix 11: FAQ Change History

Changes since version 1.6: 8/1/97

-- Typo's, edits, new URL's and e-mail addresses submitted by 
      you, the viewing audience.
-- Addition of a review by Daniel P.B. Smith for the books section. 
   READ IT !!   
-- Move section 30 up to 24 and renumber for a more logical flow.
-- categorized and cleaned up of web references in section 26.

Changes since version 1.5: 5/1/97

   -- Typo's, edits, and new e-mail addresses. Keep those cards and letters

   -- New Section 32 on how $ORDER really works

   -- New Section 33 on M as a Learning Language

   -- Redo of Section 4 to include new books available.

   -- Some more URL edits and additions to section

   -- Implementation of a great idea from Dan Baer about an e-mail and URL appendix.
	 Basically, I will now refer to people and companies by name, and add an appendix 
	 of e-mail and URL addresses. A One-Stop-shop for contact information.

   -- Changes to all sections to remove 'hard-coded' e-mail addresses.
   --  Change history moved to Appendix 11. Only current changes will appear at top of FAQ.

Changes since version 1.4: 1/1/97

   Typo's, edits, and new e-mail addresses. Keep those cards and letters
   Additional (author unknown) definition to section 1. what is M?

Changes since version 1.3: 10/1/96

   Expansion of Section 25 to include M Web addresses and Newsgroups
   Addition of Section 31: A Brief History of M
   Addition of Appendix 9: Testimonials and Articles
   Minor editorial changes and spelling corrections.
   Removed Editorial History prior to 1995

Changes since Version 1.2: 07/01/96:

   Addition of X-base vs. M answer - Question 30
   Addition of Appendix 8 - Mumps, A Solution Looking For A Problem, By Chris Richardson
   Request for new blood.
   Change to Mumps of GA address
    General cleanup and spellcheck.

Changes since Version 1.1: 01/01/95:
   Change to the Connections Group address
   Request for thoughts on inclusion of MSM white papers.

  ''   Gardner S. Trask III                
 O\/O  "First .cultured man on the Internet"   alt.culture.gard-trask
 (  )  Creator of 'Circut, the Internet Owl(tm)'
  ""   Best One-Line Slam: 'You have a ponytail, don't you." -Alex Suter

User Contributions:

Oct 26, 2021 @ 4:16 pm
Indiana Macfarlane
M Technology and MUMPS Language FAQ, Part 1/2
M Technology and MUMPS Language FAQ, Part 1/2

1588 Davisson Street
1588 Davisson Street
United States
United States
Oct 27, 2021 @ 11:11 am
M Technology and MUMPS Language FAQ, Part 1/2

Millard Ridgeway

61 Rue Clement Marot

Comment about this article, ask questions, or add new information about this topic:

Part1 - Part2

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer: (FAQ Comments address)

Last Update March 27 2014 @ 02:11 PM