Newsgroups: comp.lang.mumps,sci.med.informatics,comp.answers,news.answers,sci.med.answers Path: news1.ucsd.edu!ihnp4.ucsd.edu!dog.ee.lbl.gov!overload.lbl.gov!lll-winken.llnl.gov!hookup!news.caren.net!news.join.ad.jp!news.imnet.ad.jp!usenet.seri.re.kr!news.kreonet.re.kr!newsxfer.itd.umich.edu!news.mathworks.com!news.kei.com!world!trask From: trask@world.std.com Subject: M Technology and MUMPS Language FAQ, Part 1/2 Message-ID: Followup-To: comp.lang.mumps Summary: Should be read by those interested in M and those who wish to post to the newsgroup comp.lang.mumps Sender: trask@world.std.com (Gardner S Trask) Reply-To: trask@world.std.com (FAQ Comments address) Organization: The World Public Access UNIX, Brookline, MA Date: Thu, 2 Nov 1995 00:51:08 GMT Approved: news-answers-request@MIT.EDU Lines: 1321 Xref: news1.ucsd.edu comp.lang.mumps:2409 sci.med.informatics:3213 comp.answers:12599 news.answers:48413 Archive-name: m-technology-faq/part1 Last-modified: 1995/07/01 Version: 1.2 Posting-Frequency: monthly M Technology and MUMPS Language FAQ This FAQ is copyright 1995 by Daniel P. B. Smith. 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 trask@world.std.com. Editors: Gardner Trask, trask@world.std.com Jon Diamond, jdiamond@hoskyns.co.uk Questions that need answers: -- A comparison of M with the xBase; -- Brief descriptions of specific, real-world, non-hospital applications; -- More information on performance/speed/benchmarks -- Concise descriptions or capsule commentaries on major M products, strengths/weaknesses, as seen by users (not vendors). -- Sould we include vendor whaite papers in the FAQ? Changes since Version 1.1: 01/01/95: Change to the Connections Group address Request for thoughts on inclusion of msm white papers. Changes since Version 1.0: 11/24/94: Added notes on the vets.vetmed.missouri.edu FTP site. Added cautionary note on CompuServe costs. Added notes and new contact names in Vendors section to reflect InterSystems Corporation's acquisition of Digital's DSM product line. Changes since Version 0.8: 11/05/94: Expanded my own remarks on GUI support to include the "write-slash" products (DT-Windows and MGM). Incorporated most changes made by Jon Diamond for the version distributed by MTA-Europe, including: clarified U.S. telephone numbers; added section 29, "What is the MDC;" emended of Ed de Moel's remarks (with Ed's permission) on M versus MUMPS. Renamed the section "Can I get comp.lang.mumps by E-mail." to "What is comp.lang.mumps? subscribe to it?" Added the comp.lang.mumps charter. Added information on accessing USENET from CompuServe. Added Scott Jones' remarks on comments affecting efficiency (section 28). Added his remarks on pseudocode to "Is M Compiled or Interpreted?" Reorganized the order of sections (some section numbers have changed). Removed section, "How does M compare to the Xbase languages?," because apparently nobody knows. In Tilman Schmidt's section under "What is M:" removed the term "dynamic programming" in response to a criticism from a correspondent who asserts that this term has a specific technical meaning which does not apply to M, and replaced it with M's own terminology ("indirection;") Sources/contributors/reviewers/participants: Ben Bishop, aci@world.std.com Jon Diamond, jdiamond@hoskyns.co.uk John D. Godfrey, Godfrey@msmail.vet.cornell.edu Gavin Greig, ggreig@mcs.dundee.ac.uk Russell Haddleton, rfh2y@uvacs.cs.Virginia.EDU Scott P. Jones, scott@INTERSYS.COM John E. Kemker, III, kemker.j@atlanta.va.gov Mark Komarinski, komarimf@craft.camp.clarkson.edu Keith F. Lynch, kfl@access.digex.net Ed de Moel, DEMOEL@FWVA.SAIC.COM Steve J. Morris, sjm2@shore.net Kevin O'Gorman, kevin@kosman.uucp Doug Preiser, preiser@cancer.unm.edu Aaron Seidman, seidman@world.std.com Tilman Schmidt, ts@gb1.sema.de Arthur B. Smith, ART@vets.vetmed.missouri.edu Richard J. Tomlinson, Richard@rtsysgen.demon.co.uk Gardner Trask, trask@world.std.com David Whitten, whitten@netcom.com 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 GUIÕs? 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. Are there M-based 4GLs and application generators? 25. Are there M bulletin boards? M FTP sites? 26. "What happened in 1841?" 27. How do I list a global directory on this unfamiliar M system? 28. Do comments really affect efficiency? 29. What is the MDC? 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 ------------------------------------------------------------------------ 1. What is M? M is a procedural, interpreted general-purpose programming language oriented towards database applications. Its characteristic features are: - untyped variables, converted automatically between numeric and string; - multi-dimensional associative arrays; - persistent variables ("globals;") - good string handling capabilities: better than BASIC, not as good as SNOBOL4 (eg. no full regular expressions;) - "indirection:" can use strings computed at runtime as part of M program text; - built-in multiuser/multitasking support. [Tilman Schmidt (ts@gb1.sema.de), ed. DPBS] M has many good points: high productivity, low hardware requirements, good scalability. But M also has some weaknesses: low transaction reliability, character-based screens, poor integration with other environments, and few development tools. [Thomas C. Salander, M Computing, June 1994, p.74] M is a lousy language with one great data type. [Steve J. Morris, sjm2@shore.net] ------------------------------------------------------------------------ 2. Where can I get a no-cost version of M? InterSystems DT-Student MS-DOS implementation of M with capacity restrictions and a licensing agreement prohibiting commercial use. Documentation is on-disk and includes both an M language manual and a programmer's manual. Requests for copies should be made in writing by mail or fax to Tommy Smith, InterSystems Corporation, One Memorial Drive, Cambridge, MA 02042. Phone 617 621-0600, Fax 617 494-1631. DT-Student can also be obtained via anonymous FTP from /pub/dtstudent at openmsql.intersys.com; in URL format, ftp://openmsql.intersys.com//pub/dtstudent/ As of 8/94, it also appears to be available for downloading from the InterSystems BBS +1 617-225-0475, the NEMUG BBS +1 508-921-6681, and the MTA-NA BBS +1 301-942-5359. Micronetics MSM-Explorer Call the MTA-NA office (not Micronetics) at +1 301-431-4070 to order a complimentary copy and to get information on other student versions. The address for Micronetics Design Corporation itself is: 1375 Piccard Drive, Rockville, MD 20850, 301-258-2605, fax +1 301-840-8943. As of 8/94, Micronetics Explorer also appears to be available from: the Micronetics Customer Support BBS +1 301-948-6825 the NEMUG BBS +1 508-921-6681, and the MTA BBS +1 301-942-5359. [One news item describes MSM-Explorer as "available at no cost to schools and colleges," suggesting that an academic connection is required, but other news items do not suggest any such restriction."] UCD MicroMUMPS True public domain version. (8/94) Available for downloading from the NEMUG BBS +1 508-921-6681, and the MTA-NA BBS +1 301-942-5359 Also available for $xx from D-M Information Systems, 1403 Fifth Street, Box 1918, Davis, CA 95617, +1 916-753-0362. There is no support. D-M describes the documentation as consisting of two READ.ME files. According to the author, this is not a full implementation of the current M, but is specifically intended for novices and is easier to use than the versions derived from commercial systems. It is best used in conjunction with the book, "ABCs of MUMPS: An Introduction for Novice and Intermediate Programmers," by Richard F. Walters, Digital Press, 1989, ISBN 1-55558-017-3. This book can be ordered from MTA-NA (see below). ------------------------------------------------------------------------ 3. What is comp.lang.mumps? How can I subscribe to it? (11/94) comp.lang.mumps is a "USENET newsgroup." It was created in July, 1994. It is an unmoderated newsgroup; anyone can post messages to it and anyone can read all the messages posted to it. The newsgroup's charter is given below. The charter is what was voted on by the USENET community when the group was created. As with all unmoderated newsgroups, the health of the newsgroup depends on goodwill, courtesy, and voluntary adherence to the spirit of the charter. Since its inception, comp.lang.mumps has been a friendly newsgroup with a comfortable volume, typically one to five messages per day. Recent topics have included: M coding standards/practices/conventions; rumors about possible M vendor mergers; job postings; and inquiries about specific problems with particular M implementations. CHARTER of comp.lang.mumps The proposed unmoderated newsgroup comp.lang.mumps will be open to discussions on almost all topics related to versions of the M technology and the M language (also known as MUMPS). Appropriate topics would include, but not be limited to, advocacy bindings to GUI platforms (M Windowing API) discussions of commercial products object-oriented extensions PC networking issues programming techniques tools etc. The only topic that is excluded is: discussion of the standard for the M (MUMPS) language, ANSI X11.1 which should be discussed in the existing group comp.std.mumps. Subsequent custom has established that informal discussions of standards- related issues are very welcome in this newsgroup. MDC members have suggested that they welcome informal discussions be conducted in comp.lang.mumps, while formal proposals should be posted to comp.std.mumps. It is also clear that the membership welcomes job postings and job information. SUBSCRIBING TO COMP.LANG.MUMPS There are different kinds of Internet access. One common situation is a company that "has Internet access" via their internal e-mail system. Such arrangements often are e-mail only; if so, you must use the "MUMPS-L gateway" access method described below. Other sites have direct access to the USENET newsgroups. This is common for academic and government sites, and commercial services. Find out whether your site has direct access to the newsgroups. If you have it, this is the best way to read and post to comp.lang.mumps. If you are on a typical UNIX host at an academic or government institution, one way to check is to type the names of the most popular "newsreaders" -- rn, trn, tin, and nn -- at the command prompt and see if any of them are installed. If not, you probably do not have USENET access and should use the MUMPS-L gateway. If you find that a newsreader is installed, consult an Internet-savvy colleague, system administrator or help desk for more information. (11/94) Most of the commercial services, including America On-Line, CompuServe, DELPHI, and Prodigy now offer direct newsgroup access. Details for CompuServe are noted below. THE MUMPS-L GATEWAY (8/94) Anybody with Internet E-mail can participate in comp.lang.mumps by making use of a gateway and mailing list provided by American University and BITNET. Out of courtesy to the host organization, please use this method only if you cannot get access to comp.lang.mumps in any other way. For those who CANNOT get comp.lang.mumps in ANY other way: To receive MUMPS-L and comp.lang.mumps: Send an e-mail message To: LISTSERV@uga.cc.uga.edu The subject line doesn't matter. The message text should consist of the single line: SUBSCRIBE MUMPS-L Within a short time, you'll get an automated acknowledgement from the list server confirming your subscription and giving other information, and you'll start getting the comp.lang.mumps and MUMPS-L posts. To post a message to MUMPS-L and comp.lang.mumps: Send an e-mail message To: MUMPS-L@uga.cc.uga.edu IMPORTANT: NOTICE THE DIFFERENCE IN THE ADDRESSES. To start and stop subscriptions, you address the request to LISTSERV. Thanks to: American University, for hosting and operating the gateway; Jim McIntosh, jim@american.edu, for administering it; Harold Pritchett, harold@UGA.CC.UGA.EDU, owner and administrator of the MUMPS-L list; and the BITNET organization generally. COMPUSERVE (1/95) Some users have advised making sure that you understand CompuServe's rates, terms, and conditions before using CompuServe to access comp.lang.mumps, as the charges may be higher than anticipated. As of 11/28/94, according to a CompuServe representative (Julie Borders), Newsgroup access is an "extended service" charged by the hour at the same rate as other extended services. "To send Internet e-mail it is $.15 for the first 7500 characters and $.05 for each additional 2500 characters. It is the same rate to receive Internet e-mail." -- [DPBS] (11/94) CompuServe now offers direct newsreader access to the Usenet newsgroups. CompuServe subscribers may already using the MUMPS-L gateway, as described above. If you are doing this now and are satisfied with this system, there's no need to change. Here are the steps I took to read comp.lang.mumps on CIS. Depending on exactly how you're set up (for example, whether you're using CIM), the details may be different for you, but everything should be clear once you GO USENET. For me: the steps were I typed "GO USENET" I chose #6, "USENET Newsreader" I read some pages of warnings, disclaimers, and advice I chose #3, "Subscribe to newsgroups" I chose #1, "Subscribe to one known newsgroup" I typed "comp.lang.mumps" in response to the prompt "Newsgroup name" I typed "m" to return to the previous menu I chose #1, "Access your USENET newsgroups." It listed "comp.lang.mumps (18 articles) " as the only newsgroup I'm subscribed to, then offered choices. I chose #3, "Read articles" --[DPBS] ------------------------------------------------------------------------ 4. What are some books about M? The following books can be ordered from any M Technology Association. Contact them for prices. In the USA, contact: M Technology Association, 1738 Elton Road, Suite 205, Silver Spring, MD 20903. Telephone +1-301-431- 4070. THE COMPLETE MUMPS by John Lewkowicz (MTA item #2030) Prentice-Hall, Englewood Cliff, N.J. ISBN 0-13-162141-6 Introductory/Tutorial: THE ABCs OF MUMPS by Richard F. Walters (MTA item #2034) Digital Press. ISBN 1-55558-017-3. COMPUTER PROGRAMMING IN STANDARD MUMPS by Arthur F. Krieg, David H. Miller, and Gregory L. Bressler (MTA item #2028) INTRODUCTION TO STANDARD MUMPS by Joan Zimmerman, revised by Thomas C. Salander(MTA item #2012) Other: MUMPS POCKET GUIDE - 1990 by Joel Achtenberg, revised by Thomas C. Salander (MTA item #2018) A COOKBOOK OF MUMPS by David B. Brown & Donald H. Glaeser, D.Sc.(MTA item #2024) ------------------------------------------------------------------------ 5. What do M programmers love about M? High productivity, low hardware requirements, good scalability. [Thomas C. Salander in M Computing, June 1994, p.74] I still program with other languages (Pascal, C, APL, LISP, and so on), but almost always find myself saying, 'but it's so much easier in MUMPS!' ... it's just plain quicker to implement most applications MUMPS. MUMPS is a powerful computing language designed to solve real-world problems. [John Lewkowicz, The Complete MUMPS, p. xii] When I was first at the VA, Greg here gave me a 1 page batch of M code and asked if I could do it any faster in C. Two weeks, a lot of aspirin, and two compilers later, I had 'barely' working code (it would only run *once*). [Mark Komarinski, komarimf@craft.camp.clarkson.edu] M is powerful and succinct. It's excellent for general hacking. If I suddenly get a hankering for the first thousand digits of pi, or for all the order 4 magic squares, or for a table of word frequencies in a document, I don't know of any language I can accomplish this in faster. [Keith F. Lynch, kfl@access.digex.net] f p=2,3:2 s q=1 x "f f=3:2 q:f*f>p!'q s q=p#f" w:q p,?$x\8+1*8 [part of Keith Lynch's .signature; it prints a table of primes, including code to format it neatly into columns--DPBS] I really like the way that the global tree is "just there" without any file opening, record declarations, and the like. [Kevin O'Gorman, kevin@kosman.uucp] Indirection. Execute strings. String subscripts. Enormously valuable. No other language has all of them. [Ricardo Garcia] I haven't touched MUMPS since the late 70's. I`ve been missing globals ever since. While I was using MUMPS I implemented a simple programming tool couple of pages of MUMPS code. I've missed that tool ever since, as well as how easy it was to implement. [Steve J. Morris, sjm2@shore.net] ------------------------------------------------------------------------ 6. What things about M are generally disliked? Low transaction reliability, character-based screens, poor integration with other environments, and few development tools. [Thomas C. Salander in M Computing, June 1994, p.74] Are all vendors utilities crap? Having worked with DTM, DSM, MSM it seems lots of effort went into the M and no thought went into the programmer utilities. [Richard J. Tomlinson, Richard@rtsysgen.demon.co.uk] When I look back on my Fortran code from school I am a little embarrassed but I understand it. When I look back on my MUMPS I can't even read it without slow token by token translation. It's amazing to me how fluent I was when I wrote it and how fluent I'm not when I read it. [Steve J. Morris, sjm2@shore.net] It's possible to write completely obfuscated MUMPS code, and too many MUMPS programmers do it. Some even brag about nobody else being able to read their code. Fortunately for those of us in the VA who have to maintain that code, they are becoming a minority. [John E. Kemker, III, kemker.j@atlanta.va.gov] ------------------------------------------------------------------------ 7. Why is M called a "database language?" M is a programming language with a strong emphasis on text handling and database management. However, M is NOT a data base management system. The disadvantage of being a programming language is that it takes more expertise to apply the language to create a working data base, but the advantage of not being a dedicated database management system is that it is infinitely more flexible. [Ed de Moel, DEMOEL@FWVA.SAIC.COM] ------------------------------------------------------------------------ 8. Is M an RDBMS? The so-called DBMS component of M is another name for the feature of persistent associative array variables, i.e. arrays that can be indexed by strings, on an arbitrary number of levels, and that survive the termination of the program, being transparently stored on a permanent medium (hard disk). This feature is comparable to what ISAM (Indexed Sequential Access Method) packages offer for other languages, but it is more powerful than ISAM and it is seamlessly integrated into the language. It is *not* a relational database system, although it can serve as a basis for implementing one and does so in several commercial products. [Tilman Schmidt (ts@gb1.sema.de)] Databases that have a lot of many-to-many relations, and/or a lot of sparse information (fields that are more often empty than filled in) do not fit the relational model well. While a relational database can represent this data, it does it with great complexity or inefficency. The sparse hierarchical array structure assumed by M is a much more natural fit for this type of data. [Arthur B. Smith, ART@vets.vetmed.missouri.edu] The M standards suite includes a standard for embedded SQL, and embedded SQL is provided in commercial products such as InterSystems' M/SQL and KBase's KB/SQL. [David Whitten, whitten@netcom.com] Initial development of the "relational model" of databases appeared to place MUMPS at a disadvantage, but recent advances in so-called non-first-normal form, a reference to hierarchical structures characteric of MUMPS, open the door for MUMPS to take a leadership role in current research in that field. [Richard F. Walters, "The ABCs of MUMPS"] ------------------------------------------------------------------------ 9. Is M compiled or interpreted? M was designed to be interpreted. Real compilation of an M program into a machine program for the target machine is not feasible due to the following of M's features: - The XECUTE verb allows execution of a runtime string value as an M program, and indirection allows substitution of runtime string values into the executed source code. Therefore a complete M interpreter must be present at runtime, anyway. - Indirection allows variable names and labels to be taken from string variables, so all names of variables and labels in the source text must be available at runtime, i.e. stored within the compiled program. - The $TEXT function allows access to the program source text at runtime, so in principle the whole source must be kept together with the compiled program. In practice, most M interpreters precompile programs into an intermediate, binary form that is more compact to store, and more efficient to execute. The requirement of keeping the source text around is relaxed by conventions limiting the use of $TEXT to comment lines, or to comments starting with two semicolons, and M interpreters often offer the option of keeping just these parts of the source (which of course breaks programs not respecting the convention). [Tilman Schmidt (ts@gb1.sema.de)] Greystone has a product that compiles to .EXE files that are comparable in size to C source .EXEs. [David Whitten, whitten@netcom.com] Most of the versions of MUMPS these days are pre-compilers; a tokenized version of the routine is actually stored separately and usually runs faster. [Ben Bishop, aci@world.std.com] The reasons to use a pseudo-code approach instead of trying to generate machine code has a lot to do with memory efficiency - M has a well deserved reputation for requiring very little in the way of hardware resources, such as RAM. It also has a lot to do with what people do in M. If you do profiles on M applications, you find that much of the time they are doing things that wouldn't be helped by trying to compile to assembly code anyway (they are accessing globals, doing I/O, etc.). Also, with a good C implementation of M, I can port to a new Unix platform in a day or so (and then take a few weeks more if we want to assembly optimize the most commonly executed simple tokens - which I have done for most of the current architectures (Intel, Alpha, Mips, RS/6000-PowerPC, Motorola 68K, Motorola 88K, and Sparc). That would not be possible with an implementation that actually compiled to machine code. (Look at the delays of moving VC++ 2.0 to non-Intel architectures). Finally, with pseudo-code (we call ours m-code), you can share a compiled routine across all platforms (as we do with our M/SQL code). [Scott P. Jones, scott@INTERSYS.COM] ------------------------------------------------------------------------ 10. How fast is M? One company developing heavily in MUMPS ran tests to determine performance characteristics of MUMPS vs. Oracle. MUMPS ran approximately six times faster. Digital's DSM (Digital Standard MUMPS) consistently sets benchmark records for transaction processing. [John E. Kemker, III, kemker.j@atlanta.va.gov] In benchmarking MUMPS and alternatives such as RPG, BASIC, COBOL and FORTRAN, Casimiro Alonso reports that "A user choosing MUMPS for interactive data base applications can expect up to five times more power from a given computer" and that "the applications development took about one-third the amount of time forecast for the use of other languages...." with the MUMPS database occupying "only one-half to one-quarter of the disk space required by others. [C. Alonso, A Case for MUMPS, Computerworld, January 9, 1984, as cited by William J. Harvey and Frederick G. Kohun in the article, "MUMPS," from Encyclopedia of Microcomputers, 1993.] Very rough tests suggest that DTM is about twice as fast as Visual BASIC's implementation of the BASIC language. These tests involve simple code, coded similarly in each language, that exercise fundamental operations that are common to, and natural in, both languages (FOR loops involving arithmetic and fundamental string operations). On a 33MHz 386DX, Visual BASIC runs at very roughly 1000-2000 commands/second, DTM about twice that. Double that for a 486 DX2, quadruple that for a Pentium. [DPBS] ------------------------------------------------------------------------ 11. Does M support Microsoft Windows and other GUIÕs? A 1994 addition to the M standard, the M Windowing API (MWAPI), defines an interface between the M language and windowing systems. InterSystems and Micronetics offer versions of M that implement the MWAPI in a Microsoft Windows environment. Digital has an implementation [is it commercially released? Details?] for Windows NT. The M Windowing API and its commercial implementations are relatively new and have rough edges. The MWAPI has the advantage of portability and platform-independence, but has some limitations associated with the "least- common-denominator" approach. A unique feature of the MWAPI is that this "API" does not consist of subroutine calls (except for a few incidental functions). MWAPI programming consists mainly of performing sets and kills into a "structured system variable," which looks like a standard M global. For example, to set the title of a window to "M Technology Demonstration," you write s ^$WINDOW("main","TITLE")="M Technology Demonstration" To make its dimensions 300 by 200, you write s ^$WINDOW("main","SIZE")="300,200" The MWAPI is currently offered for Microsoft Windows by InterSystems and Micronetics, and for Windows NT by Digital Equipment Corporation. It is often presented as the windowing future for M technology. VISUAL-BASIC-LIKE APPROACHES InterSystems' "Visual M" is a set of tools which link M with Microsoft Visual Basic, creating an integrated dual-language environment. M code can be accessed and edited from within the VB design environment, can access VB control properties, and can be triggered by VB events. Micronetics [product name????] provides a Visual-Basic-like environment entirely based on M and the MWAPI. "WRITE-SLASH" APPROACHES InterSystems' "DT-Windows," MGlobal's MGM-PC (for MS-Windows) and MGM-Mac (for the Macintosh) use a feature of the M standard that allows the language to be extended for device-specific purposes by means of the "write-slash" syntax. In DT-Windows and MGM, the windowing system is treated as a "device" with an unusually rich repertoire of device-specific commands. Although DT-Windows and MGM are conceptually similar, they are incompatible with each other. They are ad-hoc language extensions. Neither seems to have set a defacto standard. Why do these products (DT-Windows and MGM) provide a nonstandard approach? The answer, in part, is that they were introduced prior to the finalization of the MWAPI standard. Why do they still exist? Because they are closer to their underlying windowing platform than the MWAPI, they arguably provide better performance and broader access to the GUI system's functionality. Examples from the DT-Windows manual and MGM product literature, respectively, show how an "OK" button is added to a dialog box: DT-Windows w /waddbutton(2,65,40,10,20,1,1,1,0,0,0,"OK",1) MGM W /DBUTTON("OK",2,9) ------------------------------------------------------------------------ 12. Are there any M magazines or journals? The M Technology Association publishes "M Computing," a technical journal. Members receive it free. See Appendix 2. MTA-Europe publishes "M Professional" a news/technical journal in English 3 times a year. MTA-Europe members receive it free. Non-members can order a subscription. Other MTAs also produce newsletters, mostly in local languages. Contact them directly for more information. ------------------------------------------------------------------------ 13. Which is the "official" name, M or MUMPS? This topic seems to be the M community's very own little religious war. The following represents the editor's opinion. Other views, including one from a member of the MUMPS Development Committee, are represented in Appendix 4. M and MUMPS are alternate names for the same language. M, the newer name, is now very widely accepted in the M community. The name change was introduced to address long-standing problems with the name MUMPS. The name MUMPS gave many the impression that the language was specifically for hospitals and health care applications. Many also felt it was undignified. M/MUMPS has evolved rapidly, with new ANSI standards being successfully issued in 1977, 1984, 1990, and a new standard now in canvass, which will probably issue in 1995. It is not the same language that it was in 1967. [DPBS] ------------------------------------------------------------------------ 14. Is M a mainstream language? 1991 worldwide revenue in the M marketplace was estimated at $1 billion, projected to grow to $2 billion by 1996. Approximately 2,000 individuals/organisations belong to M Technology Association-North America, with approximately another 1,000 belonging to other MTAs. Versions of the M language are available from twelve vendors on every significant hardware platform. Some versions provide direct support for non- English languages, for example German, Russian, Japanese. But: "The national meeting of the MTA draws fewer attendees than the northeast regional meeting of the SAS Users' Group." [Thomas C. Salander, M Computing, June 1994, p. 72]. ------------------------------------------------------------------------ 15. Is M useful for non-medical applications? Although it originated in a medical environment, nothing in the language is specific to medical applications. Non-medical applications can be, and have been, implemented successfully in M. The Gartner Group report, "1992 MUMPS Assessment and Opportunity," notes: "[M-based trust software from NCS] is used by several of the top 200 U.S. banks to control more than 375 accounts totalling $600 billion in trust assets. Lloyds of London, Barclays, and Bank of Bermuda ... use M systems... M moved into communication, shipping and transportation, law enforcement and other areas in the 1970s and 1980s. The Veteran's Administration, Discovery Channel, Coca-Cola and Schweppes, Ltd. Star Shipping, and the Law School Admission Service are among the M users." A recent M Technology Association press release describes how M Systems Plus won a contract with American Express's Travel Related Service Division (AMEX) in Atlanta contract to convert 2,000 cruise bookings acquired from a West Coast firm. It is said that the M System was designed and developed within two and a half weeks, and was up and running on schedule, processing over 500 telephone booking inquiries the first day. It has since been expanded to include brochure fulfillment, customer service, word processing, questionnaires that gauge customer reaction, and agent telephone activity tracking. [DPBS] ------------------------------------------------------------------------ 16. Is M object-oriented? No. A working group within MDC (the MUMPS development committee) is, however, actively considering object-oriented extensions. One vendor, ESI is marketing a development system, ESIObjects, that allows fully object-oriented programming in M. ESI, 5 Commonwealth Road, Natick, MA 01760, +1-508-651-1400, FAX +1-508-651-0708 [DPBS] However, M has many of the characteristics of newer OO languages. For example: dynamic memory usage, late-binding, encapsulation possibilities. [Jon Diamond, jdiamond@hoskyns.co.uk] ------------------------------------------------------------------------ 17. Is M structured? Yes, no, maybe, sort of. M syntax is not for purists or academicians. If you want to code in a structured style: -- you may not love M's syntax, but you can live with it; -- the necessary features are there; -- they do, however, have an "add-on" or "makeshift" flavor. M does not enforce a structured style. And because the features that support structured programming were absent from the MUMPS of the early eighties, there is a substantial body of unstructured legacy code still in use, and a substantial number of M programmers comfortable with what might be called the "traditional" coding style. The M "ELSE" statement is a simple executable statement. It is not syntactically paired with an IF. The semantics are, approximately: a special system value, $TEST, is reminiscent of the "condition bits" in some processor. An IF statement sets the value of $TEST according to whether the condition was true or false. An ELSE statement is equivalent to IF '$TEST (the apostrophe is the "not" operator). Unfortunately, the traditional MUMPS subroutine does not push and pop the state of $TEST. Thus, If a>b Write !,"a is greater." Else Write !,"b is greater." performs as expected, but If a>b Do REPORT1 Else Do REPORT2 may not, particularly if the REPORT1 subroutine itself contains If statements of its own. This problem is solved by a feature called the "argumentless Do." Actually the argumently Do plays three separate roles in M programming: -- It can do the job performed by continuation lines in other languages; -- It provides a mechanism for multiline IF's and FOR's; -- because and argumentless Do, unlike a standard Do (!), does stack and pop the value of $TEST, it can be used to write structures that look and act like nested IF-THEN-ELSE statements in other languages. If condition1 Do . If condition2 Do . . ;executes if condition1 and 2 are both true . . . . . Else Do . . ;executes if condition1 is true but not condition2 . . . . Else Do . ;executes if condition1 is false . . [DPBS] Is MUMPS structured? I think it is. We haven't outlawed the GOTO true, but we have named subroutines, controlled loops (while loop is the same as argumentless FOR with a QUIT), iterated loops (FOR), Parameter Passing to subroutines, functions with return values... We also have line scoping on IFs, ELSEs and FORs. What else do you need to be structured? [David Whitten, whitten@netcom.com] What about declaration of variables? What about scope of variables aside from line scope? I'm not convinced that the "while" exactly counts as a feature of MUMPS - in fact, an argumentless FOR with a QUIT is a "repeat...until", for a "while" you would need to perform an initial IF. Do such composite statements really count as proper controlled loops? Even if MUMPS is technically structured, it goes (IMHO) against the spirit of structured programming with commands reduced to a single letter whenever possible, short variable names encouraged, and no white space. The significance of the space character (in argumentless commands) is completely counter intuitive. I can't say that technically you're not correct in mentioning the above features but one of the primary aims of structured programming is to make support of existing code easier. In my experience, MUMPS encourages hacking and badly designed code. [Gavin Greig, ggreig@mcs.dundee.ac.uk] ------------------------------------------------------------------------ 18. Is M suitable for multiuser systems? Yes. An important feature of the M language is that the standard language core includes multiuser and multitasking features. These facilitate writing portable distributed-processing applications. A "JOB" command allows one process to initiate other, independent processes. Processes can arbitrate access to resources with each other via a "LOCK" command. There is no specific formal interprocess communication. Interprocess communication is achieved via the LOCK mechanism and shared use of "global" data (which are available to all processes) [--DPBS] ------------------------------------------------------------------------ 19. Does M work on LANs? Yes. The primary method of implentation might be termed "remote global access." Globals residing on a remote system can be accessed and locked simply by using extended syntax to refer to them. For example, ^HERE(name,address) refers to a piece of data on my local system, while ^|DENVER|THERE(name,address) might refer to a piece of data on a remove system. Thus, the same programming techniques used to build multiuser and multiprocess applications on a single system can be used to build distributed network systems. In addition to this explicit networking most vendors allow for implicit network referencing, allowing system managers to choose the location of data independent of the application programs. A networking protocol standard, "Open MUMPS Interconnect," provides least- common-denominator capability so that systems from different vendors can participate on the same network. In addition, for competitive reasons, most vendors support the major protocols of their competitors. An M-based LAN system in use at Brigham and Women's hospital, with 3,000 PC clients and over 100 servers, is a well-known and very successful application of the technology. There are also a number of systems with M operating in more complex client/server situations, with M acting as a front-end to other systems and also a back-end via RPC etc to applications created using other tools, for example Visual Basic, C++ and so on. ------------------------------------------------------------------------ 20. Is M standard? 1977: accepted as an ANSI standard, ANSI/MDC X11.1 1984: revised ANSI standard ANSI/MDC X11.1-1984 1986: approved as a Federal Information Processing Standard (FIPS) 1990: revised ANSI standard ANSI/MDC X11.1-1990 1992: accepted as an international standard, ISO/IEC 11756-1992 1993: revised FIPS 125-1 1994: revised standard currently in ANSI canvass procedure for approval as ANSI/MDC X11.1-1994 (or maybe 1995) and distributed for comments in ISO as ISO/IEC 11756-1995. [DPBS, compiled from others' comments] ------------------------------------------------------------------------ 21. Is M portable? As a standardized language, M is portable as long as only the features defined in the standard are used. In practice, the portability of M programs is typically as good as or better than that of C, and much better than BASIC, because, unlike BASIC for example, standard MUMPS is sufficiently rich to implement real-world applications mostly without resorting to vendor-specific extensions. [Tilman Schmidt, ts@gb1.sema.de] The contents of the ISO standard is IDENTICAL to the contents of the ANSI standard. This is another thing that makes M[UMPS] special: it is not uncommon that nationally accepted versions of standards differ in details from their internationally accepted counterparts. [Ed de Moel, DEMOEL@FWVA.SAIC.COM] MUMPS has better portability than C or any other language I'm aware of. The VA has successfully run the same 15000 routine system on almost every platform imaginable. VA Kernel and FileMan, the core of Decentralized Hospital Computer Program (DHCP) and CHCS (The DoD version of DHCP) and IHS (Indian Health Services) has been run, with very few changes, on machines ranging from PC's (over 80 VA Medical Centers running on 486's) to VAXen (other VA's running VMS) to Alpha AXP's (the replacement for the VAXen and some 486 sites) to IBM RS/6000's running AIX (DoD with CHCS from SAIC) . [John E. Kemker, III, kemker.j@atlanta.va.gov] MUMPS is available for at least the following platforms: MSDOS v2.0+ (single-user or multi-user) Unix - Altos, AT&T 3B2, Bull XPS and DPX/2, Control Data 4000, Data General AViiON, Digital Equipment VAX/Alpha, Hewlett Packard 9000, IBM RS/6000, ICL DRS 6000, Motorola Delta, Phillips P9000, MIPS, Nixdorf Targon 31, NCR Tower, Pyramid, Sequent, Siemens, Sun, Texas Instruments 1500, Unisys 5000 and 6000 Apple Macintosh OS VMS - Digital Equipment VAX/Alpha VM - IBM mainframe Netware Windows 3.1 Windows NT [Jon Diamond, jdiamond@hoskyns.co.uk] ------------------------------------------------------------------------ 22. How does M compare to SQL? M is a full-featured procedural general-purpose programming language. SQL is a declarative language for relational database queries only, and must be embedded in a general-purpose programming language in order to achieve Turing completeness. M accesses its database at low level, almost like programming in ISAM level. SQL works on the relational level, a higher level of abstraction. ------------------------------------------------------------------------ 23. How does M compare to BASIC: Both are procedural, interpreted applications languages. Both have a line-oriented, verb-object type syntax. M has additional features: better string handling, multidimensional string-indexed arrays, persistent variables, multitasking, multi-user support, dynamic code. M offers greater standardization and portability. Although there is an ANSI standard for BASIC, it is of little practical importance because few vendors conform to it, it is not rich enough to permit development of real-world applications within the standard, and there is a tradition of non-standard vendor extensions. The state of M standardization is superior. The Veterans' Administration, in particular, took a leadership role in writing validation suites that assure vendor conformance to the standard. Vendor choice: BASIC is currently dominated by a single company, Microsoft. There are other vendors but few have any practical importance. M is available from a wider range of vendors. ------------------------------------------------------------------------ 24. Are there M-based 4GLs and application generators? DASL (DSM Application Software Library). Based on DSM (Digital Standard M), it allows one to build database applications by defining data items and interactively designing screen placement. DASL runs on VMS and Unix platforms. "I used to build apps with DASL... One of the things I really liked about DASL is that it handled a lot of routine stuff, allowing me to build apps in about 30% of the time that it would have taken with straight M coding-- which, in turn, is considerably faster than coding in most other languages :^) Because DASL is written in M it was easy to modify to add special features." [Aaron Seidman] Others include: InterSystems Open M/SQL. Micronetics ViEW. Hoskyns MDM. Cybertools CyberM. Veterans Administration Kernel (public-domain). [Jon Diamond, jdiamond@hoskyns.co.uk] ------------------------------------------------------------------------ 25. Are there M bulletin boards? M FTP sites? [01/95] Arthur B. Smith, ART@vets.vetmed.missouri.edu, has recently launched what is probably the first general-purpose public M FTP site. You can reach it by anonymous ftp. The location, in URL format, is: ftp://vets.vetmed.missouri.edu//mumps/ For conventional ftp access, issue the command ftp vets.vetmed.missouri.edu. The beginning of a session looks like this: ftp vets.vetmed.missouri.edu Connected to vets.vetmed.missouri.edu. Name (vets.vetmed.missouri.edu:dpbsmith): anonymous 331 Anonymous Login OK, send id as password. Password: [type in your e-mail address here] 230-User logged in 230- Welcome to the University of Missouri-Columbia Department of 230- Veterinary Medicine and Surgery FTP Server. As of 1/95, this location appears to contain everything from the NEMUG BBS, as well as DT-STUDENT and the M FAQ. See the description of the NEMUB BGS, below. --DPBS (All of the BBS'es listed here are in the USA. --DPBS) DHCP BBS: (801)583-0135 Focussed on the VA's Distributed Hospital Computer Program (DHCP); not a general-use M BBS. **************** InterSystems BBS: General Users 617 225-0475 VARS 617 494-0867 **************** Micronetics on CompuServe: GO PCVENH, Section 8 and DL 8 (7/94) CompuServe forum "PC Vendors (H)" is shared by a number of vendors; Micronetics occupies section 8 for messages, and DL 8 for files. The forum has received about five postings in the last two weeks, and is basically an extension of Micronetics' support services. Most threads begin as customer questions addressed to Micronetics support, and most files are product patches press releases, etc. **************** Micronetics Customer Support BBS: (301) 948-6825 (7/94) Content similar to Micronetics section on CompuServe. Primarily a customer support mechanism. [Micronetics Explorer, a student version of MSM, appears to be available for downloading from this BBS as EXP1.ZIP and EXP2.ZIP]. Some examples of files available for downloading: %ZAB.RTN MUMPS 624 05/94 Display $ZA bit settings for device... 3C507.COM MAIN 5.4K 03/91 3COM 3C507 Packet Driver 408H.NOT MUMPS 7.9K 05/94 Release notes for Version 4.0.8H AGENDAS.ASC MUMPS 24K 09/91 MSM COURSE DESCRIPTIONS BISMMARK.RTN MUMPS 8.3K 04/94 Benchmark routines... COLOR.RTN MUMPS 1.8K 02/94 COLOR DEMO -- GUI EXP1.ZIP MUMPS 1.3M 12/93 Explorer File (Database) 1 of 2... EXP2.ZIP MUMPS 1.0M 12/93 Explorer File (Executables) 2 of 2... GBMAINT1.RTN MUMPS 7.0K 05/94 GLB Compression fix for PC/Plus ver 4.0.9 only **************** M Technology Association Bulletin Board, (301) 942-5359 Sysop: Ed Hinkle Baud: 1200 or 2400 bps, no parity, 8 data, 1 stop (8/94) 150 files for downloading, including VA Fileman 20.0 and no less than five versions of M: MUMPS Interpreters located in file area "MUMPS Programs & Utilities" MSM-EXPLORER Version 1.0 - File names for downloading are MSMEXP_1.EXE, MSMEXP_2.EXE and MSM_INST.HLP. DT Student Version 1.1 - File names for downloading are STUDENT1.LZH (DT Student part 1) and STUDENT2.LZH (VA FileMan 19 and Documentation part 2) NOUS Version 1.34 - File name for downloading is NOUS134.LZH TURBO-MicroMUMPS - Filename for downloading TMM.LZH UC Davis MicroMUMPS Version 5.23 - File name for downloading is MUMPS53.LZH **************** New England MUG BBS: (508) 921-6681 Sysop: Gardner Trask Baud: 300, 1200, 2400 and 9600 8 bits, no parity, one stop bit MNP5 error correction protocol 2400/9600 baud 24 hours, free (7/94) Approximately 150 M-related files available for download; examples: MUGLIB1.LZH Part 1 of MUGLIB Disk 11. Use LHA to extract (06-20-92) XPORT.RO Short M routine to change globals (06-27-93) UTILS.EXE Various MUMPS utilities (08-17-92) CALC.EXE M CALCULATOR - VER 3.00 - PKZIP EXE (11-14-92) COWRITER.EXE This is a Free CoWriter Demo. (03-18-92) DSRECOV.ZIP Recover crashed DataTree %dsbackups (09-09-92) DTM-EDTR.LZH Full-Screen editor for DataTree MUMPS. Use LH (06-19-92) HASEDIT.EXE MUMPS Editor from High Altitude. (10-19-90) KERM-MGB.LZH KERMIT-M for CCSM MUMPS. Use LHA to extract f (06-19-92) MSMSHELL.UTL MSM's Programmer Shell Utility (12-30-91) MUMPS53.LZH UC Davis MicroMUMPS Ver 5.23 ($H Fix). (06-11-92) NOUS134.LZH NOUS is a MUMPS Interpreter which contains Pr (09-23-92) STUDENT.EXE DT-STUDENT. FREE MUMPS System. Auto Pkunzip. (09-15-92) TMM.LZH TURBO-MicroMUMPS is a MUMPS Interpreter. (10-19-92) FMV20.ZIP VA FileMan Verion 20 (09-23-93) FMPRO.LZH VA FileMan Programmer Manual. Use LHA210.EXE (06-15-92) XMTECH32.LZH MailMan 3.2 Technical Manual. Use LHA210.EXE (06-15-92) HURST.ZIP MUMPS games and files for ISC's M/VX. (09-16-91) IDEAFACT.EXE The Idea Factory by C. Volkstorf (03-23-92) MBBS792.TXT Other known MUMPS BBS Boards as of 7/92 (07-24-92) POSTNET.ZIP print USPS POSTNET barcodes using M (06-01-93) SSVN.TXT Guy Gardner's paper on SSVN's for Windowing (03-04-92) ------------------------------------------------------------------------ 26. "What happened in 1841?" In M, the current date and time is contained in a special system variable, $H (for "HOROLOG"). The format is a pair of integers separated by a comma, e.g. "54321,12345" The first number is the number of days since December 31st, 1840, i.e. day number 1 is January 1st, 1841; the second is the number of seconds since midnight. But why 1841? According to Steve Clay, steve_clay@delphi.com, the following answer appeared in the "Just Ask!" column of the September 1993 issue of "M Computing," a publication of the M Technology Association, Silver Spring, MD 20903 (Phone: 301-431-4070), in the form of a letter from James M. Poitras: "Starting in early 1969, our group created the Chemistry Lab application at Massachusetts General Hospital (MGH), which was the first package in the MGH MUMPS with Global Data Storage and many of the features of the language today... "When we started programming, there were no utility programs of any type. We had to write them all: time, date, verify database, global tally, print routine, etc. I ended up writing initial versions of most of these. "When I decided on specifications for the date routine, I remembered reading of the oldest (one of the oldest?) U.S. citizen, a Civil War veteran, who was 121 years old at the time. Since I wanted to be able to represent dates in a Julian-type form so that age could be easily calculated and to be able to represent any birth date in the numeric range selected, I decided that a starting date in the early 1840s would be 'safe.' Since my algorithm worked most logically when every fourth year was a leap year, the first year was taken as 1841. The zero point was then December 30, 1840... "That's the origin of December 31, 1840 or January 1, 1841. I wasn't party to the MDC negotiations, but I did explain the logic of my choice to members of the Committee." ------------------------------------------------------------------------ 27. How do I list a global directory on this unfamiliar M system? Although the M language itself is standardized, the operating environment and utilities, alas, are not. And they are nonstandardized in the worst way: the actual functionality doesn't vary much across vendors, but the details do. Gardner Trask has provided the following guide: Function MSM DSM MVX/MSQL DTM ---------------------------------------------------------- Utility Menu %UTL %UTL UTIL zzu Routine Directory %RD/%ROU %RD/%RDX %RD/%RDISP %rd Routine Print %RP %RS %RO %rsave Routine Change %RCHANGE %RCE %RCHANGE %rsearch Routine COmpare %RCMP %RCMP %RCMP %rloadcompare Global Directory %GD/%GLO %GD %GD/%GDISP %gd Global List %GL %G %G %g Global Edit %GEDIT %GEDT %GED %gedit Global Change %GCHANGE %ZGE %GCHANGE %gedit Global Transfer %GCOPY %GC %GOQ/%GIQ [Gardner Trask, trask@world.std.com] 28. Do comments really affect efficiency? [In case anyone is not familiar with Scott Jones, let me say, in a offhand, understated way, that he knows what he is talking about--DPBS] A number of people have talked about the performance/maintenance issues with comments, so I thought I'd clear things up a bit, at least for the implementations that I deal with (ISM,DTM). Double semi-colon comments are placed in-line into the object code, so it is best (from a maintenance view as well) to have a separate label for each logical section of data, followed by lines of ;; data, that is not in any path of execution. For normal comments, if they are at the end of a line that already has code on it - there is absolutely NO effect at all on performance, so comment to your hearts content. If the comment is all that is on the line, there is still a beginning of line token - which can be expensive, esp. in frequently executed loops. The reason is that the BOL token does a lot of work after every so many lines, such as allow the next process to run (on systems like DTM), or check for ^C,RESJOB, or other inter-process communication. For long runs of comments, such as the maintenance section at the top of a well written routine, if you have M/SQL (for ISM,DTM,DSM or MSM), you can simply use the macro pre-processor and bracket the code in #if 0 ... #endif. This technique totally eliminats the overhead, but it does mean that the maintenance section is not present in the M source, only in the macro source (this can be an advantage if you ship M source to customers, but don't want them to see all of your descriptions of bug fixes). Alternatively, try not to start execution on the first line, but use a label after the comment section. (i.e. DO entry^foobar instead of DO ^foobar) [Scott P. Jones, scott@INTERSYS.COM] 29. What is the MDC? The MUMPS Development Committee (MDC) is responsible for defining the M Standard. Unlike other language standards bodies (such as ANSI and ISO), the MDC is dominated by users - systems developers, rather than implementors. Anyone with an interest in the M language can join the MDC and all members have a single vote. MTA-North America acts as the MDC Secretariat and publishes all documents pertaining to ANSI X11.1, including the Standard, bindings specifications (for example, X Windows, SQL and GKS) and MDC proceedings. There are also counterparts to the MDC in Europe, Brazil and Japan (MDCCs) which feed in non-US contributions and have voting rights at the MDC. [Jon Diamond, jdiamond@hoskyns.co.uk] -- Gardner S. Trask III trask@world.std.com "First .cultured man on the Internet" alt.culture.gard-trask rahubby@sonic.net - Elf of the redwoods, sez "I don't crosspost. I post Followups to other people's Crossposted posts on occasion." ---------------------------------------------------------------------- Newsgroups: comp.lang.mumps,sci.med.informatics,comp.answers,news.answers,sci.med.answers Path: news1.ucsd.edu!ihnp4.ucsd.edu!dog.ee.lbl.gov!overload.lbl.gov!lll-winken.llnl.gov!hookup!news.mathworks.com!news.kei.com!world!trask From: trask@world.std.com Subject: M Technology and MUMPS Language FAQ, Part 2/2 Message-ID: Followup-To: comp.lang.mumps Summary: Should be read by those interested in M and those who wish to post to the newsgroup comp.lang.mumps Sender: trask@world.std.com (Gardner S Trask) Reply-To: trask@world.std.com (FAQ Comments address) Organization: The World Public Access UNIX, Brookline, MA Date: Thu, 2 Nov 1995 00:51:36 GMT Approved: news-answers-request@MIT.EDU Lines: 806 Xref: news1.ucsd.edu comp.lang.mumps:2410 sci.med.informatics:3214 comp.answers:12600 news.answers:48414 Archive-name: m-technology-faq/part2 Last-modified: 1995/07/01 Version: 1.2 Posting-Frequency: monthly M Technology and MUMPS Language FAQ This FAQ is copyright 1995 by Daniel P. B. Smith. 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 trask@world.std.com. Editors: Gardner Trask, trask@world.std.com Jon Diamond, jdiamond@hoskyns.co.uk Contents of Part 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 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 Internet: schaut@intersys.com 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 Contact: Bob Mappes, Dave Lenhard Also: Offices in UK, Germany, Switzerland 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 VISO-DATA Computer AG 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) - MUGPAL (public domain software) - MUGLIB (shared software library) - membership newsletter (US: MLink, Europe: M Update, Germany: MUMPS Borse etc) 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 MTA-Europe: Association Headquarters 1738 Elton Road, Suite 205 83 Avenue Mounier Silver Spring, MD 20903-1725 B-1200 Brussels USA Belgium Phone: +1 301-431-4070 Phone: +1 322 772 9247 Fax: +1 301-431-0017 Fax +1 322 772 7237 There are also MTAs in Belgium, Brazil, Bulgaria, China, Czech/Slovak Republics, Finland, France, Germany, Great Britain, Ireland, Israel, Italy, Japan, Netherlands, Russia, Spain, Switzerland. Please contact either of the above addresses for current information. ------------------------------------------------------------------------ Appendix 3. USA Local M Users Groups Baltimore-Washington MUG COSTAR Users' Group CONTACT: Susan Schluederberg CONTACT: COSTAR Users' Group The Connections Group, Ltd. 23715 W. Malibu Road 1100 Sunsett Drive Bel Air, MD 21014 Malibu, CA 90265 Phone #: 410-838-6062 Phone #: 310-456-9322 810-869-6301 Chicago Area LUG DECUS MUMPS SIG CONTACT: John Campbell on BBS CONTACT: Mitch Bell Phone #: 312-929-6793 200 Rector Place, #9P New York, NY 10280 Phone #: 212-657-3321 Central Florida MUG Delaware Valley MUG (Orlando-Tampa) CONTACT: D-V MUG Coordinator 213 East Bay Street P.O. Box 323 Winter Gardens, FL 34787 Reading, PA 19607-0323 CONTACT: Mike Minor Phone: 215-748-2145 Mark Gerszewski Phone #: 407-656-4990 813-978-9181 MUMPS of Georgia La MUG (Los Angeles) (formerly Southeastern MUG) Make suggestions for topics/mtg.times CONTACT: Linda Moore Contact: Steve Atlas Paragon Training 5408 Rozie Ave. 1822 Condor Drive Woodland Hills, CA 91367 Marietta, GA 30066 Phone #: 818-883-1206 Phone #: 404-975-9282 Minnesota M Users' Group New England MUG (Boston) (Minneapolis-St. Paul) CONTACT: CONTACT: Chris Hawkins Gardner Trask 508-927-7637 P.O. Box 14486 7 Galloupe Avenue Minneapolis, MN 55414 Beverly, MA. 01915 Phone #: 612-627-6166 Pacific Northwest MUG Pittsburgh Regional MUG (Seattle) CONTACT: Bill Harvey CONTACT: Arden Forrey Computer Information Systems Health Info. Admin. Program Robert Morris College Dept. of Health Services 600 5th Ave. School of Public Health and Pitsburgh, PA 15219-3099 Community Medicine Phone #: 412-262-8467 1107 NE 45th St., #355 Seattle, WA 98105 Phone #: 206-543-8810 San Francisco Area MUG Southwest MUG CONTACT: Julie Dijailia (Dallas-Fort Worth) 51 Ridgewood Ave. CONTACTS: Carol Anzaldua San Francisco, CA 94112 Peter Flores Phone #: 415-262-8467 1901 North Highway 360, #351 Grand Prairie, TX 75050 Phone: 817-633-3944 214-437-5255 Sunshine MUG Tri-State LUG (New York) (Southern Florida) CONTACT: Mitch Bell CONTACT: Mark Fedora 200 Rector Place, #9P Phone #: 305-882-5319 New York, NY 10280 Eastern Financial Credit Union Phone #: 212-657-3321 700 South Poinciana Blvd. Miami Springs, FL 33166 CONTACT: Rob Atlas Phone #: 407-394-5888 ------------------------------------------------------------------------ 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 alternatives." 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). [DPBS] 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, rfh2y@uvacs.cs.Virginia.EDU] 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, aci@world.std.com] 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, trask@world.std.com] 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, preiser@cancer.unm.edu] > 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, rick@rnason.demon.co.uk] 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 (1991). 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 Russia. 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 language. 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, DEMOEL@FWVA.SAIC.COM] ------------------------------------------------------------------------ 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. a100 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")="dpbsmith@world.std.com" 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="dpbsmith@world.std.com" $PIECE("world.std.com",".",2) yields "std". SET $P(X,"@",1)="office" causes X to become "office@world.std.com". ORDER FUNCTION: New a 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 INTRINSIC (built-in) FUNCTIONS: 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" [DPBS] ------------------------------------------------------------------------ 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 2 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 7 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 13 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 ;------------------------------------------------------------ 20 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:ValHigh High=Val 39 Quit 40 StatsX Quit 41 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 48 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]. Notes: 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 easier. 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 . . ;executes if condition1 and 2 are both true . . . . . Else Do . . ;executes if condition1 is true but not condition2 . . . . Else Do . ;executes if condition1 is false . . ------------------------------------------------------------------------ Appendix 7: An example of "traditional" M coding style %DTC %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 ; YX D YMD S Y=X_% G DD^%DT 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 Q 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) Q COMMA ; S %D=X<0 S:%D X=-X S %=$S($D(X2):+X2,1:2),X=$J(X,1,%),%=$L(X)-3- $E(23456789,%),%L=$S($D(X3):X3,1:12) 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 %,%D,%L Q 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 scope. 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. -- Gardner S. Trask III trask@world.std.com "First .cultured man on the Internet" alt.culture.gard-trask rahubby@sonic.net - Elf of the redwoods, sez "I don't crosspost. I post Followups to other people's Crossposted posts on occasion." .