violin的声音's profile燕南飞之蓝色幻想PhotosBlogListsMore Tools Help

violin的声音

There are no photo albums.
No list items have been added yet.
There are no music lists on this space.

燕南飞之蓝色幻想

April 27

rtf文件格式资料

今天在做rft文件的解析
copy别人一个blog就充一下资料吧

RTF文件格式研究报告(代开版辞)

摘要: 本文对RTF文件格式进行分析研究,对RTF文件结构及特性进行了阐述,并分别列举了几个实用性的例子进行详细分析,最终通过VB程序代码实现了一个RTF书写器(不具有所见即所得特性)。本文对软件开发人员及RTF文件格式感兴趣的人员具有参考价值。

关键字:RTFRich Text FormatOffice、文件格式。

一、引言

富文本格式(RTF)规范是为了便于在应用程序之间轻松转储格式化文本和图形的一种编码方法。现在,用户可以利用特定转换软件,在不同系统如MS-DOSWindowsOS/2MacintoshPower Macintosh的应用程序之间转移字处理文档。RTF规范提供一种在不同的输出设备、操作环境和操作系统之间交换文本和图形的一种格式。RTF使用ANSI, PC-8, Macintosh, IBM PC字符集控制文档的表示法和格式化,包括屏幕显示和打印。凭借RTF规范,不同的操作系统和不同的软件程序创建的文档能够在这些操作系统和应用程序之间传递。

将一个格式化的文件转换为RTF文件的软件称为RTF书写器。RTF书写器用于分离现有文本中的程序控制信息,并且生成一个包含文本和与之相关的RTF组的新文件。将RTF文件转换成格式化文件的软件则称为RTF阅读器。

二、RTF基本语法

RTF文件由未格式化本文、控制字、控制符和组组成。RTF文件没有限制文件的行的最大长度。

控制字RTF用来标记打印控制符和管理文档信息的一种特殊格式的命令。一个控制字最长32个字符。控制字的使用格式如下:

\字母序列<分隔符>

注意:每个控制字均以一个反斜杠\开头。字母序列由az 的小写字母组成。控制字(或者称为关键字)通常应该不包含任何大写字母。

分隔符标记RTF控制字的结束, 可以是下列各项之一:

·      一个空格,这时空格是控制字的一部份。

·      一个数字或连字符(-), 表示跟随的一个数值参数。该数字序列的长度由其后的一个空格或除了字母和数字的其他字符划定。这个参数可以是正数或者负数,它的取值范围通常是从-32767到32767。

·      任何非字母和数字的其他字符。这种情况下,此分隔字符结束控制字,而它并不属于控制字的一部分。

控制符由一个反斜线\跟随单个非字母字符组成。例如,\~代表一个不换行空格。控制符不需要分隔符。

由包括在({})中的文本、控制字或控制符组成。左扩符({)表示组的开始,右扩符(})表示组的结束。每个组包括文本和文本的不同属性。RTF文件也能同时包括字体、格式、屏幕颜色、图形、脚注、注释(注解)、文件头和文件尾、摘要信息、域和书签的组合,以及文档、区段、段落和字符的格式属性。如果包括字体、文件、格式、屏幕颜色、校订标记,以及摘要信息组、文档格式属性,则他们一定要在文件的第一纯文本字符之前,这些组形成RTF的文件头。如果包括字体组,则它应该在格式组之前。如果组未使用,可以省略。

对于RTF文件的详细语法及关键字说明请参阅《Rich Text Format (RTF) Specification v1.7》,这里不作更详细的说明。

三、Hello Word

国际惯例,一个Hello Word!演示例子,内容如下:

{\rtf1\ansi\ansicpg936\deff0\deflang1033\deflangfe2052

{\fonttbl{\f0\fmodern\fprq6\fcharset134 \'cb\'ce\'cc\'e5;}}

{\*\generator Msftedit 5.41.21.2500;}\viewkind4\uc1\pard\lang2052\f0\fs20 Hello World!\par}

     该文件分析如下(红色):

1、文件基本属性:

{\rtf1 RTF版本\ansi字符集\ansicpg936简体中文\deff0默认字体0\deflang1033美国英语\deflangfe2052中国汉语

2、字体表:

{\fonttbl{\f0字体0\fmodern\fprq6字体间距为6\fcharset134GB2312国标码 \'cb\'ce\'cc\'e5宋体;}}

3、生成器信息:

{\*\generator Msftedit 5.41.21.2500;}

4、文档属性:

\viewkind4正常视图\uc1单字节\pard默认段落属性\lang2052中国汉语\f0字体0\fs20字体大小20

5、正文文本:

Hello World!\par段落标记

}文件结束

注意:在RTF文件中,中文等双字节字符采用其单字节ASCII码序列表示,例如文本“宋体ABC”应该表示为:\'cb\'ce\'cc\'e5ABC,这就是为什么RTF可读性差的原因。如果需要通过程序获取某个字符串的合法ASCII序列,可以采用如下的VB函数:

Public Function StrToASC(ByVal strIn As String) As String

    '将中文字符串转换为ASC串(包括英文一起)

    '先将特殊字符进行转义:

    strIn = Replace(strIn, Chr(9), "\TAB ")

    strIn = Replace(strIn, Chr(13) + Chr(10), "\par ")

    Dim i As Long, s As String, lsChar As String, lsPart1 As String, lsPart2 As String

    Dim lsCharHex As String

    For i = 1 To Len(strIn)

        lsChar = Mid(strIn, i, 1)

        If lsChar = "?" Then

            lsCharHex = LCase(Hex(Asc(lsChar)))

            If Len(lsCharHex) = 4 Then

                lsCharHex = "\'" + Mid(lsCharHex, 1, 2) + "\'" + Mid(lsCharHex, 3, 2)

            Else

                lsCharHex = lsChar

            End If

            s = s + lsCharHex

        Else

            lsCharHex = LCase(Hex(Asc(lsChar)))

            If Len(lsCharHex) = 4 Then

                lsCharHex = "\'" + Mid(lsCharHex, 1, 2) + "\'" + Mid(lsCharHex, 3, 2)

            Else

                lsCharHex = lsChar

            End If

            s = s + lsCharHex

        End If

    Next

    StrToASC = s

End Function

June 29

家有新人

     明天 我的侄儿就两个星期了,8斤的小孩,一直想为他写点什么
总是没有时间,听他在电话中的哭声,仿佛看到了父亲的微笑 ,母亲
的欢喜,哥哥的兴奋,嫂子的憔悴,辛苦了 ,我们的亲人们,我们在
转转之地终于了新一代的传人。
    虽然自己不怎么迷信 ,但是给小孩子取名字还是蛮看中的 ,毕竟这
是我们家的new hope ,邦彦名字好,但是五行不好,博轩很有才气,
也是风水的问题,紫谦,和我们的姓黄色倒是蛮配的,都是高贵之气,
本想用来中和一下运气的,还是觉得彦字不错,俊才亚,五行缺金,挑
选了一个锋字,用测字软件一查,^_^,居然有96分,不错不错,各个
天格地格 人格都都很好,总格也是不错,就选它了 ,彦锋,看不来也不
名字结构也不错。自己都快成天文算术家了(想起了2004年的那些同事
大p了)
btw:哥哥说小名叫根伢子,根者 ,土,俗 ,希望小侄子好养活。
都不错的。

谁是主角

巴西对加纳的比赛 ,巴西队好像从来就不越位 ,尤其是第二个球 ,明显第一次传递的时候中路的队员已经是越位了 ,如果说他没有参与进攻 ,可以接收的(类别法国队亨利当时在中路停止了动作 ,里贝里带球打进过程)。但是这个人还在前进 ,接着二次传递 ,又是越位,球进了

虽然加纳的防守不怎么样,但是一次进攻两次越位都没有判罚,天了

世界杯的真正主角们,漂亮的回家了 ,丑陋的在继续,这就是你们要的结果

btw:

 昨天晚上没有比赛 ,发现自己晚上看代码效率很高 不是吗?

May 26

TO_DATE使用詳解

時常使用to_date函數來查詢特定時間內的資料。
但每次都是用別人寫好的語句再改一下日期,一直對TO_date函數的格式不太了解。今看了oracle的書上面to_date函數講的比較好。
 
語法:
to_data(date&time,format)
其中第一個參數date&time是我們要查詢的具體日期和時間,比如:2006年5月21日。但是這個時間也分為很多種精度的,比如:
2006年5月21日
2006年5月21日17:24
2006年5月21日17:34分55秒      
這個精度要根據實際情況來定。
 
另外一個參數format決定的日期的表示方法,比如:
2006年5月21日    可以表示為:060521、20060521、2006FEB21等等
而他們對應的format為
060521        YYMMDD
20060521      YYYYMMDD
2006FEB21     YYYYMONDD
 
示例:
select * from book where intime=to_date('2003/02/17/17/53/55','YYYY/MM/DD/HH24/MI/SS')
 
上面的語句是查詢:2003年8月17日下午5點53分55秒,入庫的書本。
其實用下面的寫法也是可以的
select * from book where intime=to_date('20030217175355','YYYYMMDDHH24MISS')
select * from book where intime=to_date
('2003-02-17-17-53-55','YYYY-MM-DD-HH24/-I-SS')
中間的連字符“/”、“:”或是“-”,並不影響表達,只是為了更加容易看清楚。
 
表示年份有以下幾種格式,及這種格式對應的表達方法:
2003年為例
YYYY        2003
YYY          003
YY            03
 
月份表示格式及表達方法:
二月分為例
MM          08
RM          IIX(羅馬數字)
MONTH       february
MON         feb
 
日期的格式及表達方法:
17號為例
DDD         76          2月的17日在本年度(不是閏年的情況)是多少天     
DD          17          在本月中是號(17號)
D           在這一個星期是哪天
 
星期的格式和表示方法:
星期一為例
DAY         monday     全名顯示 
DY          mon        縮寫
 
小時的格式和表示方法:
HH24      18    二十四小時制
 
分鐘的格式和表示方法:
MI        32    該小時32分鐘
 
秒的表示方法
SS        28    該分鐘28秒
 
 
既然知道格式和表示方法就簡單了,比如我想知道在
2005年12月15日18時21分08秒 
2006年 2月23日19時00分00秒  共入庫多少書本我們就可以用以下語句 
 
SELECT SUM(QTY) FROM BOOK WHERE INTIME BETWEEN TO_DATE('2005/12/15-18:21:08','YYYY/MM/DD-HH24:MI:SS') AND TO_DATE('2006/02/23-19:00:00','YYYY/MM/DD-HH24:MI:SS')
 
具體使用什麼樣的格式就要看我們的需要和使用習慣了,但這並不影響結果
May 25

你的定位,你的一生--解读IT人员的从业方向 转载

一、关于企业计算方向

  企业计算(Enterprise Computing)是稍时髦较好听的名词,主要是指企业信息系统如 ERP 软件(企业资源规划)、CRM 软件(客户关系管理)、SCM 软件(供应链管理,即物流软件),银行证券软件财务软件电子商务/政务(包括各种网站),数据仓库,数据挖掘,商务智能等企业信息管理系统.

  企业计算领域对人才的需求显然永远是数量最大的因为这是计算机应用最多的领域. 搞这方面的好处是:

  (1)人才需求量极大从事企业计算的公司在IT企业中占了大多数。除非在专业上一无特长一般在这一领域总能找到工作。

  (2)这方面的入门门槛相对较低(如果你的软件功底不是很深可考虑这一领域)

  (3)这方面的大公司较多大公司要赚大钱所以多将精力花在企业计算业务上.如与正规高校软件学院同学目前实习的CitiCorp、HP、IBM、SAP、NEC等公司都属这一领域的公司。如果将来想到大公司找一份相对稳定的工作,从事这方面机会要大很多。

  但从事这一领域的缺点也是明显的:

  由于这方面的入门门槛相对较低,虽然这方面的人才需求量是最大的,但将来竞争对手会较多。您会发现,即使他原不是学IT专业的人,也许他突击几个月后,做得照样像模像样。特别是当您年纪渐大后,您可能会发现,后面的年轻人可能很容易追上你的水平。如果您将来到国外去工作,你可能会发现从事这领域的人更多且高手如云。当然,若您在这一领域经过多年企业经验,达到较高境界(如能设计软件架构),则身价永远是高的。国内在这方面人才领域的主要问题是,有经验的高手太少,皮毛了解的人太多。


  从事企业计算领域,最重要的技能型技术课程是

       (1) J2EE架构与程序设计

       (2) 大型数据库系统(如Oracle)

       (3) 基于UML的系统分析与设计。

      如果说还有什么重要的技能,还可将XML与Web Service技术包含进来,若您在这几个领域掌握较好,则不愁找不到工作。其中尤其以J2EE最为重要,目前J2EE已成为企业计算软件开发的最主要平台,也是正规高校软件学院的最重要课程之一。

     尽管该课程只能作为选修课,我们希望正规高校软件学院同学无论将来想从事何种方向,都应学一下J2EE课程,至少可为将来找工作备一手关键功夫。包括想从事嵌入式或其它领域的同学,也是很有必要学一下J2EE的,毕竟J2EE是目前最重要的平台之一,即使您将来不想从事企业计算领域,了解一下J2EE也是必要的,就像一门常识课程一样。

     其它与企业计算关系较密切的技能还包括: Dot Net架构与程序设计软件测试技术软件配置管理,该领域较高层次的技能包括数据仓库技术、构件与中间件技术、设计模式等。像通信协议分析与网络程序设计,Unix系统管理等也属有些关系的课程。02级本学期开设的企业计算课程不多,主要是J2EE、Oracle/MSSQL、UML等企业计算领域的最关键技能型技术课程都已学完了。

       您应在空余时间将J2EE,DB、UML等技术再深入地钻研下去,一定要在某个领域有深入的掌握。只是跟着听课,即使学了再多课程也是没用处的,自己钻研下去才是最重要的。只一个J2EE便是博大精深的,足够你啃下去的,钻研下去,您会发现你还要学的相关知识还有很多(包括EJB、XML、Web Service、Design Pattern等)。

  虽然从事企业计算的人才很多,但以下企业计算领域无论国内外都属稀缺人才:

  (1) 掌握大型ERP系统,主要是SAP系统,包括SAP Basis(系统管理)或SAP ABAP(编程)或SAP功能模块实施(特别是财务模块FI的实施)。SAP顾问身价是最高的,而且非常难找。其它大型ERP系统,掌握PeopleSoft、Oracle Finacial、J.D.Edward、Siebel等大型ERP软件系统的人也很值钱。这方面的人之所以身价奇高,主要是因为这些软件很专业,特别大,很难有D版可学习,只有特大企业(如世界500强,90以上使用SAP)才用得起,而且必须有实际工作经验才能掌握。如果是一个个人人都很容易有机会接触的软件,那么这方面的人通常就不会稀缺。如果大家将来有机会接触学习这些大型ERP软件系统的机会,建议毫不犹豫地抓住,那将捧上一辈的金饭碗。

       在国外,会SAP的人特别值钱。物以稀为贵,这永远是颠扑不破的真理。SAP的价值不仅是因为他是一个ERP软件, 而是其中体现的现代企业管理理念(如根据订货需求自动安排原料采购和生产计划等)。一般500强公司绝不会像国内很多企业那样,用J2EE从头设计企业的ERP系统(即将是怎样的人力投入,而且设计出来的系统怎么可能是完善的),一定都会使用SAP这样成熟的ERP软件。用不起SAP的公司可能会用J2EE设计ERP系统。

  (2) 掌握IBM大型机技术的人,如S/390主机,MVS操作系统,JCL作业控制语言,COBOL程序设计语言,DB2关系数据库或IMS层次数据库,CISC中间件交易控制系统等IBM大型机专用技术。国内五大银行,以及国外绝大多数银行的后台系统使用的都是以上平台。IBM大型机号称永不宕机而且平台相对封闭(这样最安全),所以这些要求在24*7环境中连续运行的关键应用(术语叫mission critical applications)都采用IBM大型机。

      这方面的人才之所以稀缺,是因为会大型机的人都是老人(90年代以前搞IT的人),全世界新毕业的IT毕业生不可能再去学IBM大型机(这是一种相对“古老“的技术)没有新人补上而银行的系统必须维持下去而且银行还要不断开发新业务(如新的存款品种)虽然对IBM大型机人才的绝对需求量不很大但相对恒定银行到哪里找这方面的新人很难找到. 若好找花旗软件也不会花那么大的代价去培训我们的实习同学了(去年培训20多个人听说公司就花了数十万元培训费). 如果您将来到国外找工作会IBM大型机可能是最好找工作的领域之一了而且保证找的都是大银行等好工作我以前教过的计算机专业90-94级的一些同学凡是毕业后从事大型机开发的现多在国外一些很好的公司工作(有几位同学在各国各公司跳来跳去简直如履平地).

       其实我觉得我们最幸福的同学就是在花旗软件做IBM大型机银行软件的同学这样的机会太难得了.正规高校软件学院00级22班一位同学当初放弃保研看准在花旗软件做大型机并且非常努力还未毕业公司便派她到国外参加一个项目的开发成了项目骨干我觉得她当初选择是完全正确的,01级一位女同学刚刚也自愿放弃了保研机会去花旗做大型机,我们祝愿她将来也能有好的前景。其实像花旗软件主动安排并鼓励员工读在职研究生,这样开明的公司目前并不多的,在职读研也是一种不错的选择,又不会失去自己喜欢的实习工作机会,能兼顾)读书的最终目地还是为了工作. 如果您将来在国外找工作根本没人管您是什么文凭国外企业绝不会花冤枉钱只会招有领域工作经验能立即上手的人用最少的钱在限定的时间完成项目. 而在国内因为人力成本较低公司招聘一很多高学历的人才尽管可能根本用不到这么高的学历但国内的人力太便宜了为什么不高消费一下人才呢这样公司的门面还要好看些。

  (3) 其它如掌握数据仓库技术的人在国内也很少. 目前最主流的数据仓库平台应是ORACLE的数据仓库工具. 在国外会一些特殊数据仓库的人如NCR/TEREDATA的人非常难找.

  年轻人充满热情喜欢追逐一些热门技术,这当然正确的毕竟学习SAP和大型机的机会毕竟不多毕业时先能找到一份工作是重要的. 但我相信随着年纪的增长大家将来慢慢都会思考的掌握一项竞争对手较少的绝技的重要性将来如果自己到国外工作什么技术最好找工作(对搞软件的人到国外工作或移民是最容易的也许您现在不想但我相信工作多年以后很大一部分同学可能想到国外闯荡一下)你要考虑你今后一生的出路什么样的绝技是最稳定最轻松最高收入的. 搞软件的人当年纪大些时您可能更向住像搞医学人的那样能更多靠经验吃饭而不须整天像年轻人那样不得不去追逐不断出现的软件新技术这个时候也许您也许会发现如果您在SAP或大型机等方面有些绝技您会有很大优势因为这些较偏的领域其技术变化是相对很缓慢的.

  我还记得在2002年时我曾在业余时间与一位德国人合作面试一些IT人才到德国去那时德方各公司发来的需求有很多是SAP和IBM大型机的我们在众多应聘者中最后也未找到一个在这方面有经验甚至是有一点经验的. 相反掌握流行技术的人因太多而不很值钱.

  找工作时不仅要盯着国内市场还要有一种放眼全球的眼光,对搞软件的人您将来完全可能到其它国家去工作. 尤其是在欧美、日本、新加坡等国家,对SAP(包括IBM大型机)人才的需求是很大的。毕竟比同学见得多些提醒同学将来多留意有学习这些绝技的机会一旦有机会建议当仁不让. 国内的人才市场可访问www.51job.com,国外的IT人才需求可访问www.hotjobs.comwww.workopolis.comwww.monster.com等著名网站。应经常访问这些网站,以了解市场对人才的具体需求,早做准备。 www.uiok.net

  以上对企业计算领域的观点供大家参考.虽然观点未必正确但确是直言不讳. 总之每个人的脑袋都长在自己脖子上每个人都应有自己的判断.

  还要注意我以上纯粹是从将来就业的角度谈问题. 如果您将来准备到国外读书则应重视基础课像CAssemblyOOPDiscrete MathData StructureOpeating SystemDatabase PrincipleNetworkSoftware EngineeringCompilerDigital CircuitComputer GraphicsComputer Component and Architecture等基础课在国外大学IT专业中一般都能找到相同课程若国内学过到国外读书时一般可申请免修一部分. 但我也想提醒同学如果您将来毕业时万一申请国外大学不成不得不去找工作时,若只将精力花在这些IT专业学生都会的基础课上(传统IT教育模式) 未掌握一些像J2EE等技能型技术是不容易找到一份工作的我们已有同学有这样的教训。从找工作的角度讲,企业关心的不是您学过什么课程,而是关心您能做什么,有什么技能,能做什么项目。

  二、关于嵌入式系统方向

  嵌入式系统无疑是当前最热门最有发展前途的IT应用领域之一。嵌入式系统用在一些特定专用设备上,通常这些设备的硬件资源(如处理器、存储器等)非常有限,并且对成本很敏感,有时对实时响应要求很高等。特别是随着消费家电的智能化,嵌入式更显重要。像我们平常常见到的手机PDA电子字典可视电话VCD/DVD/MP3 Player、数字相机(DC)、数字摄像机(DV)、U-Disk、机顶盒(Set Top Box)、高清电视(HDTV)、游戏机、智能玩具、交换机、路由器、数控设备或仪表、汽车电子、家电控制系统、医疗仪器、航天航空设备等等都是典型的嵌入式系统。

  嵌入式系统是软硬结合的东西,搞嵌入式开发的人有两类。

  一类是学电子工程、通信工程等偏硬件专业出身的人,他们主要是搞硬件设计,有时要开发一些与硬件关系最密切的最底层软件,如BootLoader、Board Support Package(像PC的BIOS一样,往下驱动硬件,往上支持操作系统),最初级的硬件驱动程序等。他们的优势是对硬件原理非常清楚,不足是他们更擅长定义各种硬件接口,但对复杂软件系统往往力不从心(例如嵌入式操作系统原理和复杂应用软件等)。

  另一类是学软件、计算机专业出身的人,主要从事嵌入式操作系统和应用软件的开发。如果我们学软件的人对硬件原理和接口有较好的掌握,我们完全也可写BSP和硬件驱动程序。嵌入式硬件设计完后,各种功能就全靠软件来实现了,嵌入式设备的增值很大程度上取决于嵌入式软件,这占了嵌入式系统的最主要工作(目前有很多公司将硬件设计包给了专门的硬件公司,稍复杂的硬件都交给台湾或国外公司设计,国内的硬件设计力量很弱,很多嵌入式公司自己只负责开发软件,因为公司都知道,嵌入式产品的差异很大程度在软件上,在软件方面是最有“花头“可做的),所以我们搞软件的人完全不用担心我们在嵌入式市场上的用武之地,越是智能设备越是复杂系统,软件越起关键作用,而且这是目前的趋势。

  从事嵌入式软件开发的好处是:

  (1) 目前国内外这方面的人都很稀缺。一方面,是因为这一领域入门门槛较高,不仅要懂较底层软件(例如操作系统级、驱动程序级软件),对软件专业水平要求较高(嵌入式系统对软件设计的时间和空间效率要求较高),而且必须懂得硬件的工作原理,所以非专业IT人员很难切入这一领域另一方面,是因为这一领域较新,目前发展太快,很多软硬件技术出现时间不长或正在出现(如ARM处理器、嵌入式操作系统、MPEG技术、无线通信协议等),掌握这些新技术的人当然很找。嵌入式人才稀缺,身价自然就高,越有经验价格就越高。其实嵌入式人才稀少根本原因可能是大多数人无条件接触这需要相应的嵌入式开发板和软件另外需要有经验的人进行指导开发流程。

  (2) 与企业计算等应用软件不同,嵌入式领域人才的工作强度通常低一些(但收入不低)。搞企业应用软件的IT企业,这个用户的系统搞完了,又得去搞下一个用户的,而且每个用户的需求和完成时间都得按客户要求改变,往往疲于奔命,重复劳动。相比而言,搞嵌入式系统的公司,都有自己的产品计划,按自己的节奏行事。所开发的产品通常是通用的,不会因客户的不同而修改。一个产品型号开发完了,往往有较长一段空闲时间(或只是对软件进行一些小修补),有时间进行充电和休整。另外,从事嵌入式软件的每个人工作范围相对狭窄,所涉及的专业技术范围就是那些(ARM、RTOS、MPEG、802.11等),时间长了这些东西会越搞越有经验,卖卖老本,几句指导也够让那些初入道者琢磨半年的。若搞应用软件,可能下一个客户要换成一个完全不同的软件开发平台,那就苦了。

  (3) 哪天若想创业,搞自已的产品,那么嵌入式是一个不错的主意,这可不像应用软件那样容易被盗版。土木学院有一个叫启明星的公司开发出一个好象叫“工程e”的掌上PDA,施工技术人员用该PDA可当场进行土木概预算和其它土木计算,据说销路特好。我认识的某大学老师,他开发的饭馆用的点菜PDA(WinCE平台,可无线连网和上网),据他说销路不错,饭馆点点PDA让客户点菜,多显派头档次。当年有一组同学在学Windows程序设计课程时用VC设计了一个功能很强的点菜系统做为课程项目,当时真想建议他们将这个软件做成PDA,估计会有些销路(上海火车站南广场的Macdonald便使用很漂亮的PDA给用户点食品,像摸像样的)。这些PDA的硬件设计一般都是请其它公司给订做(这叫“贴牌”:OEM),都是通用的硬件,我们只管设计软件就变成自己的产品了。

  从事嵌入式软件开发的缺点是:

  (1) 入门起点较高,所用到的技术往往都有一定难度,若软硬件基础不好,特别是操作系统级软件功底不深,则可能不适于此行。

  (2) 这方面的企业数量要远少于企业计算类企业。特别是从事嵌入式的小企业数量较多(小企业要搞自己的产品创业),知名大公司较少(搞嵌入式的大公司主要有Intel、Motorola、TI、Philip、Samsung、Sony、Futjtum、Bell-Alcatel、意法半导体、Microtek、研华、华为、中兴通信、上广电等制造类企业)。这些企业的习惯思维方式是到电子、通信等偏硬专业找人。由于正规高校软件学院以前毕业生以企业计算为主,所以正规高校软件学院与这些企业联系相对较少。正规高校软件学院正积极努力,目前已与其中部分公司建立了联系,争取今后能有正规高校软件学院同学到这些企业中实习或就业。

  (3) 有少数公司经常要硕士以上的人搞嵌入式,主要是基于嵌入式的难度。但大多数公司也并无此要求,只要有经验即可。

  正规高校软件学院同学若学习嵌入式,显然应偏重于嵌入式软件,特别是嵌入式操作系统方面,应是我们的强项。对于搞嵌入式软件的人,最重要的技术显然是(实际上很多公司的招聘广告上就是这样写的):

  (1) 掌握主流嵌入式微处理器的结构与原理

  (2) 必须掌握一个嵌入式操作系统

  (3) 必须熟悉嵌入式软件开发流程并至少做过一个嵌入式软件项目。

  正规高校软件学院在嵌入式软件方面最重要的课程包括:

  (1) 嵌入式微处理器结构与应用:这是一门嵌入式硬件基础课程,正规高校软件学院用这门课取代了传统的“微机原理与接口”课程(目前国内已有少部分高校IT专业这样做了,因为讲x86微机原理与接口很难找到实际用处,只为教学而已)。我们说过,嵌入式是软硬件结合的技术,搞嵌入式软件的人应对ARM处理器工作原理和接口技术有充分了解,包括ARM的汇编指令系统。

        若不了解处理器原理,怎么能控制硬件工作,怎么能写出节省内存又运行高速的最优代码(嵌入式软件设计特别讲究时空效率),怎么能写出驱动程序(驱动程序都是与硬件打交道的)很多公司招聘嵌入式软件人员时都要求熟悉ARM处理器,将来若同学到公司中从事嵌入式软件开发,公司都会给你一本该设备的硬件规格说明书 (xxx Specification),您必须能看懂其中的内存分布和端口使用等最基本的说明(就像x86汇编一样),否则怎么设计软件。有些同学觉得嵌入式处理器课程较枯燥,这主要是硬件课程都较抽象的原因,等我们的嵌入式实验室10月份建好后,您做了一些实验后就会觉得看得见摸得着。还有同学对ARM汇编不感兴趣,以为嵌入式开发用C语言就足够了。其实不应仅是将汇编语言当成一个程序设计语言,学汇编主要是为了掌握处理器工作原理的。一个不熟悉汇编语言的人,怎么能在该处理器写出最优的C语言代码。

       在嵌入式开发的一些关键部分,有时还必须写汇编,如Bootloader等(可能还包括BSP)。特别是在对速度有极高要求的场合(如DSP处理器的高速图像采集和图像解压缩),目前主要还要靠汇编写程序(我看到过很多公司是这样做的)。当您在一个嵌入式公司工作时,在查看描述原理的手册时,可能很多都是用汇编描述的(我就遇到过),这是因为很多硬件设计人员只会写或者喜欢用汇编描述,此时您就必须看懂汇编程序,否则软硬件人员可能就无法交流。很多嵌入式职位招聘时都要求熟悉汇编。

  (2) 嵌入式操作系统类课程

  除了WinCE的实时性稍差外,大多数嵌入式操作系统的实时性都很强所以也可称为实时操作系统Real Time Operating System.从事嵌入式的人至少须掌握一个嵌入式操作系统(当然掌握两个更好)这在嵌入式的所有技术中是最为关键的了。目前最重要的RTOS主要包括:

  第一类、传统的经典RTOS:最主要的便是 Vxworks 操作系统,以及其Tornado开发平台。Vxworks因出现稍早,实时性很强(据说可在1ms内响应外部事件请求),并且内核可极微(据说最小可8K),可靠性较高等,所以在北美,Vxworks占据了嵌入式系统的多半疆山。特别是在通信设备等实时性要求较高的系统中,几乎非Vxworks莫属。Vxworks的很多概念和技术都和Linux很类似,主要是C语言开发。像Bell-alcatel、Lucent、华为等通信企业在开发产品时,Vxworks用得很多。但Vxworks因价格很高,所以一些小公司或小产品中往往用不起。目前很多公司都在往嵌入式Linux转(听说华为目前正在这样转)。但无论如何,Vxworks在一段长时间内仍是不可动摇的。与Vxworks类似的稍有名的实时操作系统还有pSOS、QNX、Nucleus等RTOS。

  第二类、嵌入式 Linux 操作系统:Linux的前途除作为服务器操作系统外,最成功的便是在嵌入式领域的应用,原因当然是免费、开源、支持软件多、呼拥者众,这样嵌入式产品成本会低。Linux本身不是一个为嵌入式设计的操作系统,不是微内核的,并且实时性不强。目前应用在嵌入式领域的Linux系统主要有两类:一类是专为嵌入式设计的已被裁减过的Linux系统,最常用的是uClinux(不带MMU功能),目前占较大应用份额,可在ARM7上跑另一类是跑在ARM 9上的,一般是将Linux 2.4.18内核移植在其上,可使用更多的Linux功能(当然uClinux更可跑在ARM 9上)。很多人预测,嵌入式Linux预计将占嵌入式操作系统的50以上份额,非常重要。缺点是熟悉Linux的人太少,开发难度稍大。另外,目前我们能发现很多教材和很多大学都以ucOS/II为教学用实时操作系统,这主要是由于ucOS/II较简单,且开源,非常适合入门者学习实时操作系统原理,但由于ucOS/II功能有限,实用用得较少,所以正规高校软件学院不将其作为教学重点,要学习就应学直接实用的,比如 uClinux就很实用。况且熟悉了Linux开发,不仅在嵌入式领域有用,对开发Linux应用软件,对加深操作系统的认识也有帮助,可谓一举多得。据我所知,目前Intel、Philip都在大搞ARMLINUX的嵌入式开发,Fujitum则是在自己的处理器上大搞Linux开发。目前在嵌入式Linux领域,以下几个方面的人特别难找,一是能将Linux移植到某个新型号的开发版上二是能写Linux驱动程序的人三是熟悉Linux内核裁减和优化的人。正规高校软件学院在该嵌入式Linux方面的课程系列是:本科生操作系统必修课,然后是Linux程序设计选修课,最后是嵌入式Linux系统选修课。正规高校软件学院在Linux方面目前已有较强力量,魏老师和张老师熟悉Linux开发,金老师和唐老师熟悉Linux系统管理。

  第三类Windows CE 嵌入式操作系统:Microsoft也看准了嵌入式的巨大市场,MS永远是最厉害的,WinCE出来只有几年时间,但目前已占据了很大市场份额,特别是在PDA、手机、显示仪表等界面要求较高或者要求快速开发的场合,WinCE目前已很流行(据说有一家卖工控机的公司板子卖得太好,以至来不及为客户裁减WinCE)。WinCE目前主要为4.2版(.NET),开发平台主要为WinCE Platform Builder,有时也用EVC环境开发一些较上层的应用,由于WinCE开发都是大家熟悉的VC环境,所以正规高校软件学院学过Windows程序设计课程的同学都不会有多大难度,这也是WinCE容易被人们接受的原因,开发环境方便快速,微软的强大技术支持,WinCE开发难度远低于嵌入式Linux。

        对于急于完成,不想拿嵌入式Linux冒险的开发场合,WinCE是最合适了(找嵌入式Linux的人可没那么好找的),毕竟公司不能像学生学习那样试试看,保证开发成功更重要。根据不同的侧重点 ,WinCE还有两个特殊版本,一个是MS PocketPC操作系统专用于PDA上(掌上电脑),另一个是MS SmartPhone操作系统用于智能手机上(带PDA功能的手机),两者也都属于WinCE平台。在PDA和手机市场上,除WinCE外,著名的PDA嵌入式操作系统还有Palm OS(因出现很早,很有名)、Symbian 等,但在WinCE的强劲冲击下,Palm和Symbian来日还能有多长正规高校软件学院可能是全国高校中唯一一家开设专门的“Windows CE嵌入式操作系统“课程的学校,这主要是基于以下原因:正规高校软件学院本身前面便有Windows程序设计课程,同学学过VC后再学WinCE非常方便自然,通过学习WinCE同样也可了解嵌入式软件的一般开发过程,对Linux有惧怕心理的同学也很合适。

         很显然,嵌入式Linux永远不可能替代WinCE,而且将来谁占份额大还很难讲,毕竟很多人更愿意接受MS的平台,就像各国政府都在大力推LINUX已好长时间,但您能看到几个在PC机上真正使用LINUX的用户据我观察目前在嵌入式平台上LINUX是叫得最响但还是WinCE实际用得更多.嵌入式LINUX可能更多地是一些有长远产品计划的公司为降低成本而进行长远考虑 二是微软亚洲研究院对正规高校软件学院WinCE课程的支持计划,我们也很希望将来正规高校软件学院能有同学通过微软的面试去实习。WinCE和多媒体(如MPEG技术)是微软亚洲工程院目前做得较多的项目领域之一他们很需要精通WinCE的人。

  总结关于嵌入式操作系统类课程,若您觉得自己功底较深且能钻研下去,则可去学嵌入式Linux若您觉得自己VC功底较好且想短平快地学嵌入式开发,则正规高校软件学院的WinCE课程是最好的选择。

  (3) 嵌入式开发的其它相关软件课程

  搞嵌入式若能熟悉嵌入式应用的一些主要领域,这样的人更受企业欢迎。主要的相关领域包括:

  A、数字图像压缩技术:这是嵌入式最重要最热门的应用领域之一,主要是应掌握MPEG编解码算法和技术,如DVD、MP3、PDA、高精电视、机顶盒等都涉及MPEG高速解码问题。为此,正规高校软件学院已预订了一位能开设数字图像处理课程的博士。

  B、通信协议及编程技术:这包括传统的TCP/IP协议和热门的无线通信协议。首先,大多数嵌入式设备都要连入局域网或Internet,所以首先应掌握TCP/IP协议及其编程,这是需首要掌握的基本技术其次,无线通信是目前的大趋势,所以掌握无线通信协议及编程也是是很重要的。无结通信协议包括无线局域网通信协议802.11系列,Bluetooth,以及移动通信(如GPRS、GSM、CDMA等)。

  C、网络与信息安全技术:如加密技术数字证书CA等。正规高校软件学院有这方面的选修课。

  D、DSP技术:DSP是Digital Signal Process数字信号处理的意思,DSP处理器通过硬件实现数字信号处理算法,如高速数据采集、压缩、解压缩、通信等。数字信号处理是电子、通信等硬件专业的课程,对于搞软件的人若能了解一下最好。目前DSP人才较缺。如果有信号与系统、数字信号处理等课程基础,对于学习MPEG编解码原理会有很大帮助。

  (4) 嵌入式开发的相关硬件基础

  对于软件工程专业的学生,从事嵌入式软件开发,像数字电路、计算机组成原理、嵌入式微处理器结构等硬件课程是较重要的。另外,汇编语言、C/C、数据结构和算法、特别是操作系统等软件基础课也是十分重要的。我们的主要目地是能看懂硬件工作原理,但重点应是在嵌入式软件,特别操作系统级软件,那将是我们的优势。

  我们的研究生里有些是学电子、通信类专业过来的,有较好的模拟电路和单片机基础,学嵌入式非常合适。嵌入式本身就是从单片机发展过来的,只是单片机不带OS,而现在很多嵌入式应用越来越复杂,以至不得不引入嵌入式操作系统。另外,为追求更高速的信号处理速度,现在在一些速度要求较高的场合,有不少公司是将一些DSP算法,如MPEG压缩解压缩算法等用硬件来实现,这就涉及到HDL数字电路设计技术及其FPGA/IP核实现技术,这方面的人目前市场上也很缺。

  (5) 题外话

  另外,能写驱动程序的人目前是非常紧缺的(驱动程序也可归于嵌入式范畴),包括桌面Windows中的DDK开发环境和WDM驱动程序。公司每时每刻都要推出新产品,每一个新产品出来了,要能被操作系统所使用,是必须写驱动程序的。写驱动程序就必须掌握操作系统(如Windows或Linux)的内部工作原理,还涉及到少量硬件知识,难度较大,所以这方面的人很难找。想成为高手的同学,也可从驱动程序方面获得突破。我可说一下自己的经历,三年前我曾短暂地在一家公司写过WinCE驱动程序(正是因为知道这方面的人紧缺,所以才要做这方面的事),尽管那以前从未做过驱动程序,应聘那个职位时正是看准了公司是很难招聘到这方面的人,既然都找不到人,驱动还得有人做,这正是可能有机会切入这一领域的大好机会。面试时大讲自己写过多少万行汇编程序,对计算机工作原理如何清楚,简历中又写着我曾阅读完两本关于Windows Driver Model的两本英文原版书,写过几个小型的驱动程序练习程序(其实根本没写过,我们的同学将来千万不要像我这样,早练就些过硬功夫,就不至于沦落到我这等地步,就不用像我那样去“欺骗”公司了,我这是一个典型的反面教材),居然一切都PASS(当然最重要的是笔试和面试问题还说得过去),这只能说明这一领域找人的困难程度。公司本就未指望找到搞过驱动的人,找个有相关基础的人就算不错了。做了以后,发现也并不是怎样难的。其实搞驱动程序的工作是很舒服的,搞完一个版本就会空一段时间,只有等公司新的芯片推出或新的OS出现后,才需要再去开发新一版驱动,那时有将近一个月时间空闲着在等WinCE .NET Beta版推出,准备将驱动程序升级到CE .NET上,现在在软件学院工作整日忙,无限怀念那段悠闲时光。

  很巧合,最近本人无意中再次体会到了嵌入式的迷人之处。上周我那用了3年的手机终于不能WORK了。此次更新,除要求有手机常见功能外,最好有MP3功能(现在很多英语听力都有MP3文件),最好有英汉词典,最好还能读WORD文档。最后选了个满足以上条件的最便宜的手机DOPOD 515(斩了我2.2K,但想想这也算自己对嵌入式事业的支持,这样便也想开了),算得上最低档的智能手机了。回来一查,手机的about显示,本手机Processor是ARM,其OS是MS Smartphone(即WinCE .NET 4.2),这么巧合,简直可做为学习嵌入式课程的产品案例了(等我们的WinCE课程开得有声有色后,希望能从微软研究院搞些Smartphone来开发开发)。有OS的手机果然了得,金山词霸、WORD、EXCEL、REGEDIT等居然都有smartphone版的,PC上的MP3、DOC等居然在download时都可被自动转换成smartphone格式,真是爽。完全可用Windows CE自己开发一些需要的程序download到自己的手机上。现在市面销售PDA智能手机火爆,MS总是财源滚滚。但我已发现国产的ARMLINUX手机出现在市面上,价格只1.2K。

  在GOOGLE网上能搜索太多的关于嵌入式系统的讨论了,我刚发现一个http:www.embyte.com 非常不错,有很多有经验者谈自己的体会投入到其中的论坛中,你会切身感到嵌入式学习的热潮。

  要么走ARMWinCE,要么走ARMLINUX,要么走ARMVXWORKS。每个搞嵌入式的人都可选一条路,条条大路通罗马。

  三、关于游戏软件方向

  将游戏软件人才称为数字媒体软件人才可能更好听些,包括游戏软件策划(最缺游戏策划的人)、游戏软件美术设计、游戏软件程序设计等多方面的人才,对软件学院,游戏软件程序设计当然是最合适的了。

  游戏软件人才的确目前很缺,听说很多游戏软件公司苦于没新人才补充,特别是没有高手补充,不得不相互挖人才,以至将游戏软件人才身价越抬越高。网上说日本教育部刚刚批准成立了日本第一家专门培养四年制游戏软件人才的本科大学。其实国内很多大学,特别是软件学院都有搞游戏软件人才的设想,但目前很少有做成的,主要原因是找不到能上游戏软件课的教师,听说有个学校只能花很大的价钱从Korea找老师来上课,果真缺到此等地步

  已有很多青少年沉湎于网游而颓废的实例,好在还不至于上升到制造精神鸦片的高度,所以开发游戏软件的人也不必每日惭悔(但开发儿童益智类游戏软件的人是不需惭悔的),如果想想这是为发展民族软件产业做贡献,那反倒是一件有意义的事情了。不过听一家游戏软件公司的老板讲,搞游戏软件开发是非常辛苦的。

  若想自己创业,搞搞游戏软件是不错的主意。现在网上网站或公司都在收购游戏软件(特别是手机游戏软件,因为手机游戏用户可选从网站上download到手机上,不像网游那么复杂),按download次数分成或一次性收购的都有。我们的同学在校期间是否也可发点小财搞得好,说不定可卖到国外网站,直接挣$$$呢。

  大致游戏分成以下几类:

  (1) PC类游戏,包括单机和网游。这类游戏开发平台基本上都是基于VC和DitrectX(如DirectShow,DirectDraw,D3D等,DirectX资料可直接到MS网站上查)。DirectX和OpenGL是两个主要的图形标准,OpenGL跨平台(Unix/Windows上都可跑),尽管很多搞研究的人对OpenGL赞不绝口,将DirectX骂得一文不值,但事实是,在Windows平台上,DirectX是最快最方便的,所以在Windows平台上的游戏还是DirectX当家。

  (2) 手机游戏:目前手机游戏主要开发平台有两类:

  第一类手机游戏是 J2ME 平台(Java 2 Micro Edition),J2ME本是为嵌入式平台设计的Java,但由于Java生来就需要Java虚拟机(JVM)来解释,所以在嵌入式产品很少用J2ME(太慢太耗内存)。但在手机游戏中J2ME倒有用武之地,我想这可能主要是Java可跨OS平台的原因,因为手机的OS是千奇百怪的。我对J2ME完全外行,但上次听Square Enix 公司的人说,J2ME与我们同学学过的J2EE还是有较大差别的。据我所知,目前手机中用的较多的是KJava语言,KJava是运行在一种叫K Java Virtual Machine的解释器上(K JVM是SUN早期为演示J2ME在嵌入式系统应用而开发的一个虚拟机),所以将在K JVM上运行的J2ME叫KJava。尽管SUN说今后不保证支持K JVM,将开发新的更高性能的J2ME虚拟机取而代之,但由于KJava出现较早,很多早期的手机游戏软件都将K JVM假想成J2ME虚拟机的标准了,所以目前有大量的KJava手机游戏软件存在,而且还在用KJava继续开发。特别是日本的手机游戏软件由于开发较早(像叫什么docomi的日本最大的电信运营商手机游戏搞得很火),多是基于KJava的。所以目前市场上在招聘手机游戏软件人才时,很多要求掌握KJava。有关J2ME请到Sun的网站上找资料。

  另一类手机游戏是 BREW 平台,BREW是美国高通公司(Qualcomm,CDMA核心技术都是该公司开发的,有无数移动通信技术专利)发明的,据说可编译成二进制代码,那当然快了。主要的开发语言是C/C。但迫于被指责为较封闭的压力,目前Qualcomm已推出BREW平台上的J2ME虚拟机(但可想像那将是怎样慢的速度)。Qualcomm搞定了很多手机制造商签定BREW授权许可协议,最狠的是Qualcomm与中国联通绑在一起大堆基于BREW的手机游戏,所以有些公司招聘时要求掌握BREW也就不奇怪了。

  去年00级22班毕业答辩时,有一位同学讲的是在公司做的KJava游戏(那是一家日本游戏软件公司),还一位同学讲的是另一家公司做的BREW游戏,看来不同的公司有不同的选择。将来谁会更火,我估计随着手机硬件资源的不断提高,不会在乎一个JVM的开销,J2ME应更有前途,毕竟它是更开放的。

  (3) 专用游戏机:如电视游戏,XBOX,PS2等。

  从著名游戏公司发来的对网游和手机游戏的人才需求,很有代表性。从中我们可看出,游戏公司对人才的需求主要是以下技术:

  (1) 计算机图形学,特别是3D编程与算法,包括DirectX OpenGL。开发平台是 VC/DIRECTXKJAVA

  (2) 公司说,手机游戏因手机资源有限,必须对图像进行压缩,所以若有一些图像压缩算法知识比较好。像若能有MPEG压缩算法较好,手机上采用的是比MPEG压缩得更狠的一些特殊算法,但触类旁通。

  (3) TCP/IP Socket编程是搞网游开发的人必须掌握的。

  (4) 人工智能知识:复杂游戏可能需要一些AI算法。

  (5) 网络与信息安全知识: 网游要防外挂。

  一般游戏公司的网游服务器是基于 Linux 平台的,所以还提出了对游戏服务器端软件工程师的技术需求(精通MSSQL、ORACLE、MYSQL等数据库,精通Linux Programming,特别是Socket编程)。还有对维护游戏网站人才需求(ASP .NET和数据库)。注意一条,最好有自己的游戏软件作品,若您应聘时能带一个 DirectX 作品,那将有多强的竞争力,所以最重要的是现在就要行动实践,实践,再实践

失落在数字时代的纸牍书信

     某天午饭时,朋友给我讲述了一件令人感伤的事情:她无意中发现了一个破旧的手提箱,里面装满了她母亲的各种来往信函。这的确是一个宝库,里面是她父亲珍藏的情书、贺年卡、照片及航空信函,这个手提箱已在柜子中沉睡了几十年。她的母亲在她5岁时就离开了人世。对我的这个几乎已把母亲忘记了的朋友来说,这是一段心路历程,母亲的生活和致命的疾病一幕幕从她的脑海里闪过。当我倾听她的故事并小心翻看著一位40年前去世的女人的照片时,我不禁想到我自己:天啊,我们到底做了些什么?

我的内心正在激烈地交战。一方面,作为技术爱好者而言,我感觉到了通讯领域的巨大进步。另一方面,作为不合格的历史学家,我担心我们并未真正意识到数字化、互联网和电脑的兴起究竟给人类的交流和值得记忆的历史给带来了何种程度的破坏。一方面,我能通过互联网穿越空间阻隔、同远在十几个时区外的兄弟经常免费地交流。另一方面,自1991年我迷上互联网以来就再也没有给他写过信。当然,我们彼此写电子邮件,发送讯息,有时甚至相互交谈。我们比以往更多地出现在彼此的生活中,至少是在彼此生活的边缘。但由于是即时交流,所以交谈内容都是随意的,很快就会忘记。因此每次对话都是这样开始的:“我们上次谈过这个吗?我们以前都同意这点吗?”这更像是员工会议,而不是家庭聚会。

而且,也没有了那种心跳的感觉──没有航空邮件以及异国他乡的邮票和邮戳的到来,没有了小心翼翼地打开信封,也没有了轻轻地展开信纸。现在,用鼠标点一下绿色按钮就可开始交谈,很快也会忘记我们谈过些什么。同大多数互联网上的交流一样,我们沟通的质量显然同沟通的便利程度成反比。

不仅仅是质量的问题:还有保存的问题。未来的几代人将不会对我们的创造能力拍案叫绝;他们将会对我们远离书写和打印的模拟时代,轻易地进入数字时代感到震惊;在数字时代,一切都是以数字形式保留下来的,要么就再也看不到踪影了。在不到20年的时间里这些都变成了现实。当我80年代末生活在曼谷时,我都是用手动打字机书写所有的信件,用薄薄的黄纸复制一份,因为许多信件可能会在途中丢失。我收发的这些信件比我在互联网时代之后所写的任何信件都更接近于我朋友母亲的信函。

作为不合格的历史学家,我一直保留著各种这些双向交流的记录,包括写给我的所有信件、生日贺卡和明信片。我仍保留著这些,尽管它们已经非常脆弱而无法扫描进我的电脑中,但却非常具有价值,而不能扔掉,这令我的太太深为不满。当然,自进入互联网时代以来,保存此类财富的工作就变得更加简单了,因为需要保存的非数字化信息非常少。但我的感觉却并不好。首先,浏览过去的电子邮件或数码照片在感觉上就不如传统的信件或照片。其次,不是所有的数字内容都得到平等的对待:我们的网上对话能够永远保留下来,但看来我们并不想这样做,比如,你是否尝试将一个重要的短信息保存到安全的地方?今后的人们会比我们更加清楚地意识到我们的生活从实物时代转向数字时代时所发生的巨大困惑。

我并不是说这样不好。能够迅速方便地接触到我们所爱的人的确很好。我相信仍由许多人仍像我朋友的母亲那样亲手写信。其中一些人肯定并未受到网络媒介本身的影响,电子邮件也写得长而深刻。但我们这代人可能是将财富保留在箱子中的最后一代人了,将要消失的不仅仅是信中的文字,还有个人信件带来的气味、感觉、触觉,以及所属的那个时代。下一代人面临的挑战可能是找到一种箱子的替代品。眼下,我建议你认真保留和备份好你的电子邮件、照片和视频内容,把它们作为数字传家宝看待。即使你已经离不开数字装备了,也可以偶尔给妈妈或孩子写封信,或是发张明信片。
May 23

M Technology and MUMPS Language FAQ, Part 2/2 续

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.

 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:Val"<"Low Low=Val Set:Val">"High 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
. . <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>

Go to FAQ Appendix


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.

Go to FAQ Appendix


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 92108)

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 sack.

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

The free MUMPS evaluation copy is available by calling Tati Goodnough, the product manager for DataTree's DT-Student at (617)-890-2082 (She is a nice lady. Don't pass up the opportunity to talk to her.) or write her at:
DataTree Inc.
c/o Tati Goodnough
300 Fifth Avenue
Waltham, Massachusetts 02154

[Editors Note: Old Address - see other sections of this FAQ]

(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).

Go to FAQ Appendix


Appendix 9: Tributes, Accolades and Honorable Mentions outside the M 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 http://www.spr.com/library/langtbl.htm. It contains a language ranking, based on the amount of effort required to code a function point and M ranks very well.

Go to FAQ Appendix


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, <ellis.bauman@AUP.WISC.EDU>
Ben Bishop, aci@shore.net
Dennis J Brevik, <dbrevik@ix.netcom.com>
Etienne Cherdlu, <gz64@cityscape.co.uk>
Floyd Dennis, <fbdennis@mindspring.com>
Jon Diamond, jon.diamond@capemini.co.uk
Rod Dorman, <rodd@panix.com>
John D. Godfrey, Godfrey@msmail.vet.cornell.edu
Gavin Greig, ggreig@mcs.dundee.ac.uk
Russell Haddleton, rfh2y@uvacs.cs.Virginia.EDU
Lev Jacob, <lev@TRENDLINE.CO.IL>
Scott P. Jones, scott@INTERSYS.COM
John E. Kemker, III,  kemker.j@atlanta.va.gov
Mark Komarinski, komarimf@craft.camp.clarkson.edu
Monika Kratzmann, <monika@INTERSYS.COM>
Jeff Loeb, LOEB.JEFFREY_L@san-diego.va.gov
Keith F. Lynch, kfl@access.digex.net
Jim McIntosh, <jim@american.edu>
Ed de Moel, DEMOEL@saltmine.radix.net
Steve J. Morris, sjm2@shore.net
Kevin O'Gorman, kevin@kosman.uucp
Paul Perrin, <Admin@admatic.com>
Doug Preiser, preiser@cancer.unm.edu
Harold Pritchett, <harold@UGA.CC.UGA.EDU>
Aaron Seidman, seidman@world.std.com
Kate Schell, cschell@radix.net
Tilman Schmidt, ts@gb1.sema.de
Arthur B. Smith, ART@vets.vetmed.missouri.edu
Daniel P. B. Smith, <dpbsmith@world.std.com>
Richard J. Tomlinson, Richard@rtsysgen.demon.co.uk
Gardner Trask, trask@world.std.com
David Whitten, whitten@netcom.com

Go to FAQ Appendix


Appendix 11: FAQ Change History

Changes since version 1.3: 10/1/96

  • Expansion of Section 25 to include M Web addresses and Newsgroups
  • Additon 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.

M Technology and MUMPS Language FAQ, Part 2/2

M-FAQ HTML version prepared by Dan Baer

Archive-name: m-technology-faq/part1 Last-modified: 1997/08/01 Version: 1.6 Posting-Frequency: monthly 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 trask@world.std.com .

Editors

Gardner Trask, trask@world.std.com
Jon Diamond, jdiamond@hoskyns.co.uk

M FAQ Part One

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 8: Mumps, A Solution Looking For A Problem By Chris Richardson
Appendix 9: Tributes, Accolades and Honorable Mentions outside the M Community
Appendix 10: Contact information: e-mail and URL's
Appendix 11: FAQ Change history

Go to FAQ Table of Contents


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:

InterSystems Corporation
One Memorial Drive Cambridge, MA 02142 USA
Telephone: 617-621-0600 Fax: 617-494-1631
Paul Schaut
Internet: schaut@intersys.com
Contact: Maureen Flaherty
Also: Offices in UK, Germany

Micronetics Design Corporation
1375 Piccard Drive Rockville, MD 20850, USA
Phone: +1 301-258-2605 Fax: +1 301-840-8943
Contact: Bob Mappes, Dave Lenhart
Also: Offices in UK, Germany, Switzerland

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

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

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 in most countries

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

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

Go to FAQ Appendix


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
1738 Elton Road, Suite 205
Silver Spring, MD USA 20903-1725
Phone: +1 301-431-4070 Phone: +1 322 772 9247
Fax: +1 301-431-0017 Fax +1 322 772 7237

MTA-Europe: Association Headquarters
83 Avenue Mounier B-1200 Brussels, Belgium

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.

You can get a list of MTA's around the World at the MTRC website.

Go to FAQ Appendix


Appendix 3. USA Local M Users Groups

A current list of M User Groups in the US can be found at the MUMPS of Georgia website.

If you need to add or change your User Group info, please fill out the form or email mga@mindspring.com

Go to FAQ Appendix


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@saltmine.radix.net]

Go to FAQ Appendix


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
ONE. 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")="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
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]

Go to FAQ Appendix

M Technology and MUMPS Language FAQ, Part 1/2续

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)

To FAQ Table of Contents


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.

To FAQ Table of Contents


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]

To FAQ Table of Contents


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].

To FAQ Table of Contents


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]

To FAQ Table of Contents


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. [DPBS]

ESI, 5 Commonwealth Road, Natick, MA 01760 1-508-651-1400, FAX 1-508-651-0708

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]

To FAQ Table of Contents


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 argumentless 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
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
..<code>
;;executes if condition1 & 2 are true
..<code>
..<code>
.Else Do
..<code>
;;executes if condition1 is true but not condition2
..<code>
..<code>
Else Do
.<code>
;;executes if condition1 is fales
.<code>
.<code>

[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]

To FAQ Table of Contents


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]

To FAQ Table of Contents


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.

To FAQ Table of Contents


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]

To FAQ Table of Contents


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@saltmine.radix.net]

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]

To FAQ Table of Contents


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.

To FAQ Table of Contents


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.

To FAQ Table of Contents


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]

To FAQ Table of Contents


Are there M bulletin boards? M FTP sites? M WWW 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].

There are several WWW sites that deal with MUMPS. Instead of listing them all here, we have only listed a few. These sites have references to other sites on the WWW.

To FAQ Table of Contents


"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."

To FAQ Table of Contents


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        %rload
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]

To FAQ Table of Contents


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 eliminates 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]

To FAQ Table of Contents


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]

To FAQ Table of Contents


Compare M with the Xbase languages

Answering complex questions is one of the biggest reasons we invest in the time and expense of using a database management system. Several types of graphical products exist today to help you query your database. Of these, dedicated front-end query and reporting tools such as Borland ReportSmith for Windows and Intersolve Q+E are probably the best-known in corporate environments. Such tools are typically client applications designed to query data from corporate databases residing on client servers. Typically, these products have no built-in data-management capabilities; many require you to have a detailed knowledge of your database and the workings of relational databases in general.

PC-based database management systems let you construct queries and produce reports. You need a fair amount of database savvy to construct a query that produces the right result. Fortunately, the products are getting better at making this process easier. The two leading PC-based database management systems are Microsoft Access 2.0 and Borland Paradox for Windows 5.0.

A query is a request for information from a database. Methods for specifying a query have improved over time. Traditionally, one would have used SQL, or structured query language. In the late 1970s, IBM Research developed a new query technique called QBE, or query by example. In QBE, one supplies query details by filling in a table with values. For instance, to locate rows where the state value is New York, one would move to the State column and enter NY. To find salaries greater than $40000, one would enter > 40000. The basic idea of QBE is to make the dialogue easy to learn and reduce any reliance on keywords or language syntax.

It is possible to set up a database in M using a tool such as the VA Fileman package. Reports can be generated by means of the Report Writer feature of VA Fileman. Related records in a database are organized together to form a file, or in MUMPS terms a global. A field is a unique observation or data element. A record is comprised of one or more fields, a file (or global in M) is a collection of records and a database is the collection of all files comprising an application. [ Jeff Loeb (loeb@san-diego.va.gov) ]

To FAQ Table of Contents


A Brief History of M

As told in a series of e-mail exchanges in comp.lang.mumps in Sept/Oct 1996. Accuracy is not insured.

From: Monika Kratzmann (monika@INTERSYS.COM)
We are looking for some historical information on the evolution of M to be published in an article. It seems natural to turn to the members of this newsgroup inviting you to provide any information on this you may have. Your consideration in providing us with your knowledge about the history of M is deeply appreciated. Thank you one and all.
Monika Kratzmann
InterSystems Corporation


"Ellis A. Bauman, 608-829-5334" (ellis.bauman@AUP.WISC.EDU)
It's not clear what specific kinds of info you're looking for, but here's a brief note on the beginnings, at least as far as I recall: The language was developed at Massachusetts General Hospital in a lab run by Dr. Octo Barnett. It was developed with federal grant money --- hence was in the public domain, and the name MUMPS stems from Massachusetts General Hospital Utility Multi-Programming System

Among the chief developers was Neil Pappilardo who later left Mass Gen, and started Meditech, adding some proprietary features to MUMPS and calling the result MIIS (Meditech Interactive Information System) --- marketing medical records systems to hospitals, clinics, medical labs,etc.

At Mass Gen, the language was used to deal with clinical medical data --- hence its strengths in string handling (lots of text data), sparse arrays (not every patient undergoes every possible lab test), and other such features. The original platform was (at least I think it was) a PDP-15. It was later ported to the PDP-11 and other similar "minis" such as the Data General machines like Novas and Eclipses. As the idea spread among other medical researchers, people began adding other features, and there soon developed a whole bunch of "dialects" which frustrated the researchers because they couldn't exchange software very easily. To solve that problem, the MUMPS Users' Group was formed and efforts to standardize the language began. Dr. Barnett was among those who was most forceful in arguing for the creation of MUG and the standardization effort. I do not remember who first proposed that ANSI approval be pursued. The current MTA organization is what MUG has evolved into, via the name change. I believe Joan Zimmerman was the first MUG staff member, and she wrote (or edited?) some of the first MUMPS tutorial materials published by MUG. There is probably lots more material, and details, available from the MTA "archives", and other people who were involved in those early days. Perhaps some of the other newsgroup members will know how to contact some of the people I've mentioned. For example, there is a short history in Chapter 1 of "The Complete MUMPS" by John Lefkowitz. There are also some historical notes in the MUMPS FAQ (for example, "What happened in 1841?"). I hope the above is both accurate and helpful.


From: rodd@panix.com (Rod Dorman)
As I recall it, the original platform was the PDP-9.


From: Lev Jacob (lev@TRENDLINE.CO.IL)
I think the original plarform was a PDP-8. When the language was adopted by DEC it was a stand-alone OS called MUMPS-11 on PDP's. I can't remember MUMPS for Novas but I can remember MUMPS for Tandem Main Frames with a Multi-Cpu built in functionality. Good luck. Jacob Lev.


From: Dennis J Brevik (dbrevik@ix.netcom.com)
The original platform was a PDP-9. When the MGH version was picked up by DEC it was productized onto the PDP-15. A couple years later it was rewritten by DEC for the PDP-11. The systems were standalone. The date that DEC officially picked up a magtape of MUMPS (PDP-9) from LCS at MGH was October 3, 1970. It was a pleasant fall day. The PDP-15 MUMPS system was installed at its first site (Health Data Management Systems of Denver) in May 1971. It took two hours to install, amazing everybody on the site, who were expecting a week or two effort.

Dr. Octo Barnett was in charge at the Laboratory of Computer Science at MGH. Neil Papalardo and Bob Greenes were major contributors. Neil went on to form Medical Information Technology (Meditech), Greenes was a medical doctor as well as holding a PhD in computer science - both degrees awarded simultaneously from Harvard. Bob went on to be President of Automated Health Systems of Wakefield MA and Burlingame CA.

In a Boston meeting in Fall 1972 Bruce Waxman of NIH told the audience in no uncertain terms that if they wanted to get NIH money for their computer projects they damned well better be using MUMPS, that NIH was not interested in reinventing THAT wheel, thank you. MUMPS took off. I was the original product line and technical leader on MUMPS-15 at DEC. Paul Stylos was the technical leader for MUMPS-11. Evelyn Dow was the original Marketing representative. And let us not forget Dave Ensor of Scotland, who made significant technical contributions. The DEC executive who originally saw the value in MUMPS was Stan Olsen. Sam Moulton was also on the technical side.
Respecfully, Dan Brevik


From: "Ellis A. Bauman, 608-829-5334" (ellis.bauman@AUP.WISC.EDU)
Well, Jacob, all I can say is that when I first encountered MUMPS (in the early to mid 1970s), it was MIIS on a PDP-15, and I later worked on a Data General machine, also MIIS. Both of those were stand-alone systems, dedicated to MUMPS (or at least a MUMPS-like, derivative, language).


From: dpbsmith@world.std.com (Daniel P. B. Smith)
Hi, Monika... There is a 16-page article, "History of the Development of Medical Information Systems at the Laboratory of Computer Science at Massachusetts General Hospital" by G. Octo Barnett, MD, in "A History of Medical Informatics," edited by Bruce I Blum and Karen Duncan, published by the ACM Press (Addison-Wesley), 1990, ISBN 0-201-50128-7. I bought it on sale for five bucks at Quantum. It's almost certainly out of print but it couldn't hurt to ask Quantum if they have any more copies kicking around.

According to the article, the first implementation, of a language called MUMPS, by Neil Pappalardo, was on a PDP-7. Not a PDP-15 or a PDP-9, a PDP-7. He traces its origins from JOSS through BBN's Telecomp and StringComp. Richard Walters' "An ABC of MUMPS" contains a "Brief History of MUMPS" on pp. 20-22 with a family tree showing the root in Rand Corporation JOSS, through BBN JOSS, via TELCOMP and STRINGCOMP to MGH MUMPS. -- Daniel P. B. Smith dpbsmith@world.std.com


From: Etienne Cherdlu (gz64@cityscape.co.uk)
Now this brings back some memories. I remember using TELCOMP back in 1969 (27 years ago). We used it, via a dial up line, on a PDP-7 (TELCOMP II) and later on a PDP-10 (TELCOMP III). I don't remember much about the machines that we used other than that we leased time from a company called Time Sharing Limited of Great Portland Street, London. I also have a note from that time about on-line storage charges. It cost 30p (about 45 cents) per 640 byte block per month! The family resemblance between TELCOMP and M is just about recognizable especially if you were familiar with MUMPS-11. The following is a fragment of TELCOMP code that was written on 12 December 1971:

1.04 TYPE #,"ENTER ONE OF THE FOLLOWING:-";MENU
1.05 TYPE FORM X FOR X=1:1:4 FOR END=10^15
1.06 READ GRNO IN FORM 15
1.065 DONE IF GRNO=END
1.07 TO STEP 1.06 IF GRNO>4
1.08 TO PART GRNO+1

2.01 DO PART 50
2.02 READ N,K
2.03 DO PART 51
2.04 TO PART 15

..

15.01 LINE FOR X=1:1:3
15.02 TYPE MINPL,MAXPL IN FORM 17
15.03 TYPE FORM 17
15.04 DO PART GRNO+15 FOR X=MNPL:STPL:MXPL

16.01 Y=(X^N)+K
16.02 Y1[X]=(((Y-MNPL)/(MXPL-MNPL))*2)-1

..

FORM 15
ITEM NUMBER?   #####
FORM 17
MINIMUM ##### MAXIMUM ######

Comparison with M:

  1. No variable declaration. No data typing (String support in TELCOMP III?)
  2. Sparse local arrays. No globals. File I/O was conventional, I think.
  3. For loop construct.
  4. TYPE command identical to MUMPS-11
  5. Part/Step numbering identical to MUMPS-11
  6. Form Input/Output feature was unique to TELCOMP.
  7. DO label+offset still exists in M today.

Clearly some of the origins of M can be seen in TEL 7) DCOMP. Does anyone know where the idea for globals originated? What elements did other languages, such as JOSS bring to M?
Regards Etienne Cherdlu


From: Jon Diamond (jon.diamond@capgemini.co.uk)
This takes me back too! Oh for the good old days - when programmers were really programmers, disks were 2.5Mb in size and part numbers ranged from 0.01 to 327.67 (or some such obvious number)!!!! Well, the comment is not totally accurate - line numbers only had 2 decimal places if you're being really picky. BTW I used to know magic numbers - 84, 84*84 84*84*84 etc FWIW. I've now forgotten what they were, but I'm sure some of you MUMPS-11 people must remember? I do know why I needed to know them, but that's another story... --
Jon Diamond, Cap Gemini UK Go Proverb: "On the second line 6 die, 8 live"

To FAQ Table of Contents


How Exactly does $ORDER work?

The first thing to be aware of is "arrays" as they work in other languages: when you have a "set" of components (like the states in the USA) you want to use a method of reference that allows you to manipulate the "set" as a unit when that is convenient, and its members when you are dealing with the properties of the individual members of that set. Now, in languages like Pascal and C, you would create an array with 50 members, and you would build a table:

State[0] = (pointer to string) "Alabama"
  State[1] =                     "Alaska"
  ...
  State[49] =                    "Wyoming"

and probably some associated tables:

Capital[0]  = "Montgomery"; Abbrev[0]  = "AL";
  Capital[1]  = "Juneau";     Abbrev[1]  = "AK";
  ...
  Capital[49] = "Cheyenne";   Abbrev[49] = "WY";

If you want to loop through these arrays, you don't need any special functions: there are 50 elements in each, and "for i=0 to 49" or for (i=0; i < 50; i++) will do just fine. In M[UMPS], arrays can be done in the same fashion, in which case For i=0:1:49 would do just fine to loop through all states, but it is much more common to use a different method of indexing the array(s), using a string as an index. You could store the array as:

State["AL"] = "Alabama/Montgomery"
   State["AK"] = "Alaska/Juneau"
   ...
   State["WY"] = "Wyoming/Cheyenne"

(or, if your method of usage would make that more convenient you could use State["Alaska"]="AK/Juneau" State["Juneau"]="AK/Alaska" for that matter). However you "index" the array, the addressing will not be as simple and straightforward as in traditional languages:

  • Your language processor will need to build an internal table to link storage positions to defined indexes.
  • This table will typically be invisible to the programmer, but you will want to query it with questions like: "i am at element "xxx", what is the next one that you have?"

Or, a simple loop across all states would look like:

Set index="" For  Set index=$order(State(index)) Quit:index=""  do...

The function $order looks at this internal table, and tells you what the next index is after the one that you specify.

So... At the first call, the specified index is "" (empty string), and $order will look for the first entry in the table. Currently this is "AK". After "AK", $order would find "AL", "AR", "AZ", etcetera, up to "WY". When called with the "last" index ("WY"), $order would return the value "" (empty string) to signal that it could find no more members.

Now, that seems fair for an array like this, and we'll always have the same 50 members, and always find the same ones in the same order, so why go through all this bother? Well, that will become clear when you're dealing with sets that are more dynamic in nature. Suppose that Good Old Fidel finally steps down and Cuba requests membership as a state, there would be a storm of protests, but let's assume that the request would be approved. In most other languages, we would have to do a lot of recoding to insert Cuba in the "proper" place in the new array of states. In M[UMPS], all we have to do is Set State("CU")="Cuba/Havana"

$order(State("CT")) currently returns "DE", but after this insertion, it would suddenly return "CU", and $order(State("CU")) would return "DE": by the way of indexing that M[UMPS] does for you "behind the scenes", indexes are always stored in alphabetic order, and you won't have to worry where things are, or how to get them into the proper sequence.

Of course, this is where it starts to matter what value you use for an index:

  • quite often, you won't store a value "as it is entered" For instance, converting a proper name to "all upper case" (or all lower case for that matter). In this example, I used upper case only abbreviations, but if the full name of the state were the index, there is no predicting whether an end-user would type Alaska, alaska, ALASKA, or (very popular typo:) ALaska.
  • it matters which "property" you use for an index.
  • If the input to your program is "the abbreviation", you'll be fine with this set-up, but if you're doing taxes, and the input to your program is the city to which the forms are to be sent (which is not even always the capital), you may very well want to build a support-table that has your "search" data as a subscript, and the essential index into the "real" table as a value

In this example, I also used another "idiosyncracy" of M[UMPS]: I stored "State/Capital" into one single value. You would use the function $Piece to separate out these values. Whether you would use a set-up like I depicted above, or

State(abbreviation,"Cap")=capital
   State(abbreviation,"Name")=name

is up to the needs of your application.

Of course (and I don't want to say that M[UMPS] is an object oriented language, it's 30 years old now, and definitely showing its age), this is a feature that you see a lot nowadays in object oriented programming as well: you pass the complete object, and leave it to the recipient-software to figure out which properties of the object are interesting to it. [Ed de Moel]

To FAQ Table of Contents


M as a first computer language.

A lively debate concerning M as a first language for non computer types had varied and interesting opinions. Here are some of them;

--
From:  Paul Perrin

I think M is a *perfect* language to learn about fundamental programming principles.

Software engineering can come later - and is abusable in any language.

A computer handles three types of execution - sequential, conditional and iterative. Each type can be demonstrated (and learned) in M with _no_ messing about - no 'declarations', no 'introductions', no 'directives', no compiling etc...

Experienced programmers _forget_ how they learned to program - Ken Knecht's 1979 definition of a string in 'Microsoft Basic' from the dilithium Press as 'a group of alphanumeric characters surrounded by double quotes' left me blank for weeks - what did he mean by group?

Character mode M is (at least) as good as the original 'basic's were for discovering what computers can 'decide' and 'think' and 'store'.

Don't listen to the experts -- they forget from whence they came.

Show him M (and follow up with Java).

Regards

Paul Perrin 

--

From:              fbdennis@mindspring.com (Floyd Dennis)
 
Paul Perrin  wrote:

>I think M is a *perfect* language to learn about fundamental programming principles.

For some reason, it surprises me that I tend to agree. <g>  Before a "beginner" can even begin to grasp such things as "structured
programming", "top-down", etc., they have to get a good feel for the basics.  Things like Control, ALU, I/O, and Storage.  M brings you a lot closer to the basics than many higher(?)-level languages.

Also - for educational purposes, interpreted languages are great.
Nothing is going to give a better instant gratification kick than
being able to type a command directly and get an immediate answer. <g>

><snip>
>Show him M (and follow up with Java).
>

*THAT* will send him running back to M in a hurry.  :)


Floyd Dennis

M Technology and MUMPS Language FAQ Part 1/2

Table of Contents

  • What is M?
  • Where can I get a no-cost version of M?
  • What is comp.lang.mumps?
  • How can I subscribe to it?
  • What are some books about M?
  • What do M programmers love about M?
  • What things about M are generally disliked?
  • Why is M called a "database language?"
  • Is M an RDBMS?
  • Is M compiled or interpreted?
  • How fast is M?
  • Does M support Microsoft Windows and other GUI's?
  • Are there any M magazines or journals?
  • Which is the "official" name, M or MUMPS?
  • Is M a mainstream language?
  • Is M useful for non-medical applications?
  • Is M object-oriented?
  • Is M structured?
  • Is M suitable for multiuser systems?
  • Does M work on LANs?
  • Is M standard?
  • Is M portable?
  • How does M compare to SQL?
  • How does M compare to BASIC
  • Are there M-based 4GLs and application generators?
  • Are there M bulletin boards? M FTP sites? WWW sites?
  • "What happened in 1841?"
  • How do I list a global directory on this unfamiliar M system?
  • Do comments really affect efficiency?
  • What is the MDC?
  • How does M compare with the Xbase languages
  • A Brief History of M
  • How exactly does $ORDER work?
  • M as a first computer language
  • 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.
    Appendix 9: Tributes, Accolades and Honorable Mentions outside the M Community
    Appendix 10: Contact information: e-mail and URL's
    Appendix 11: FAQ Change history


    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]

    Massachusetts General Hospital Utility Multi-Programming System.

    A programming language with extensive tools for the support of database management systems. MUMPS was originally used for medical records and is now widely used where multiple users access the same databases simultaneously, e.g. banks, stock exchanges, travel agencies, hospitals.

    Early MUMPS implementations for PDP-11 and IBM PC were complete operating systems, as well as programming languages, but current-day implementations usually run under a normal host operating system.

    A MUMPS program hardly ever explicitly performs low-level operations such as opening a file - there are programming constructs in the language that will do so implicitly, and most MUMPS programmers are not even aware of the operating system activity that MUMPS performs.

    Syntactically MUMPS has only one data-type: strings. Semantically, the language has many data-types: Text strings, binary strings, floating point values, integer values, Boolean values. Interpretation of strings is done inside functions, or implicitly while applying mathematical operators. Since many operations involve only moving data from one location to another, it is faster to just move uninterpreted strings. Of course, when a value is used multiple times in the context of arithmetical operations, optimised implementations will typically save the numerical value of the string.

    MUMPS was designed for portability. Currently, it is possible to share the same MUMPS database between radically different architectures, because all values are stored as text strings. The worst an implementation may have to do is swap pairs of bytes. Such multi-CPU databases are actually in use, some offices share databases between VAX, DEC Alpha, SUN, IBM PC and HP workstations.

    Versions of MUMPS are available on practically all hardware, from the smallest (IBM PC, Apple Macintosh, Acorn Archimedes), to the largest mainframe. MSM (Micronetics Standard MUMPS) runs on IBM PC RT and R6000; DSM (Digital Standard Mumps) on the PDP-11, VAX, DEC Alpha, and Windows-NT; Datatree MUMPS from InterSystems runs on IBM PC; and MGlobal MUMPS on the Macintosh. Multi-platform versions include M/SQL, available from InterSystems, PFCS <mumps@pfcs.com> and MSM.

    Greystone Technologies' GT/M runs on VAX and DEC Alpha. This is a compiler whereas the others are interpreters. GT/SQL is their SQL pre-processor.

    ISO standard 11756 (1991). ANSI standard: "MUMPS Language Standard", X11.1 (1977, 1984, 1990, 1995?).

    The MUMPS User's Group is known as the M Technology Association.

    Mailing list: MUMPS-L@UGA.BITNET.

    Usenet newsgroups: comp.lang.mumps, comp.std.mumps.

    (10 Jan 1995) [Submitted by: "Daniel P. B. Smith" Original Author unknown]

    
    

    To FAQ Table of Contents


    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).

    To FAQ Table of Contents


    What is comp.lang.mumps?

    (11/94) comp.lang.mumps (read c.l.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

    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.

    To FAQ Table of Contents


    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]

    To FAQ Table of Contents


    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.

    Introductory/Tutorial:

    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)

    Introductions and Tutorials:

    M Programming: A Comprehensive Guide
    M Programming: A Comprehensive Guide is a complete update to ABC’s of MUMPS. While ABC’s of MUMPS was an introduction for novice and intermediate M programmers, M Programming: A Comprehensive Guide, has a new section containing advanced material. This new section addresses features such as transaction processing, networking, structured system variables, and interfaces to other standards. Five new chapters have been added, covering an overview of M for readers familiar with other languages; M and the Windows environment; interaction between M and the underlying system; transaction processing; interfacing M with other standards; and error handling. Sections on interactive programming and futures have been extensively updated. M Programming: A Comprehensive Guide is an invaluable resource for everyone who is learning or using M.
    M[UMPS] by Example
    Need to know how M can be used? Need lots of examples to show you how? M[UMPS] by Example is your answer!! This book can be used as a first step to explain the language elements, including the most current additions. Here you'll find out how to use the language and take advantage of its strong points. You will also be shown the spectrum of M -- from the very beginnings to the latest -- as well as developments that are currently being formulated. Created by Ed de Moel, past Chair of the MUMPS Development Committee (MDC), this book is up-to-date information.
    ABC's of MUMPS
    This book is no longer available. See the new title, M Programming: A Comprehensive Guide to order.
    The Complete MUMPS
    This excellent book is both a learning tool and a reference manual. It explores the basics of M's unique file structure, using examples and exercises to demonstrate specific functions. The well organized appendices and index provide rapid access to specific information needed to develop complex applications. The text includes functions of the 1990 standard.
    Introduction to Standard MUMPS
    Subtitled: A Guide for the Novice, this work introduces beginning programmers to key aspects to M as a programming language and an operating system. Each chapter leads users through a series of exercises and follows with review questions based on the new material. Appendices include additional review questions and solutions to each chapter's mini-tutorials. This is an important starter' volume for anyone interested in the M language.
    The MUMPS Handbook of Efficiency Techniques
    This handbook contains 125 ways to make M applications run faster, based on actual case studies of M installations over an 11 year period. Plus, this book contains code for a software package called ANALYZER that determines which M code is slowing down the programs within an application. If you need to finetune an existing application or create a new one, this book's for you!
    Standard M Pocket Guide
    This is the must have pocket reference for any M programmer! Use this pocket-sized booklet covering the 1995 standard for a quick reference, or use it to refresh your understanding of the elements of the language. It's a practical guide for beginning and experienced programmers alike. And inexpensive enough to afford a copy for everyone!
    M Programming Language Standard ANSI/MDC X11.1-1995
    This 1995 reference work contains a three section description of various aspects of the M computer programming language. Section 1, the M Language Specification, consists of a stylized English narrative of the M language. Section 2, the M Portability Requirements, identifies constraints on the implementation and use of the language for the benefit of parties interested in achieving M portability. Section 3 is a binding to ANSI X3.64 (Terminal Device Control Mnemonics).
    How To Make A Computer Work For You -- An Introduction to the File Manager System
    Learn how to computerize your own information management needs with the power of VA FileMan. This introductory volume is especially well-suited for non-programmers who can learn how to design, edit, and retrieve database information. It's the perfect supplement to your VA FileMan documentation!
    FileMan Database Management -- System User's Technical Manual
    Discover the uses and features that make VA FileMan today's database management system of choice. You'll learn the basics and advanced concepts about data input and retrieval options, database setup, programmer tools, and the data dictionary.
    FileMan: Database Manager User Manual Volume II
    The VA FileMan manual introduces two different groups of people to the VA FileMan database manager: those with newly acquired interest in learning about advanced database managers; and experienced database managers. Volume II covers advanced database theory and practice to provide a comprehensive reference for the non-programmer user of VA FileMan.
    MDC2
    MDC Type A Document Collection: Extensions to ANSI/MDC X11.1-1995 Aren't you wondering how the NEXT ANSI Standard will be different from the 1995 Standard? Well, the answer is Now Available. The documents in this collection are approved by the MDC as proposed enhancements and extensions to the current ANSI Standard, ANSI/MDC X11.1-1995 M Programming Language. They are part of the current MDC Standard. Also included in this collection are the documents that are approved by the MDC as proposed enhancements and extensions to the current ANSI Standards, ANSI/MDC X11.2-1995 Open MUMPS Interconnect and ANSI/MDC X11.6-1994 M Windowing API. They are all part of the current MDC Standards.

    To FAQ Table of Contents


    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]

    To FAQ Table of Contents


    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]

    To FAQ Table of Contents


    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@saltmine.radix.net]

    To FAQ Table of Contents


    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"]

    To FAQ Table of Contents


    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]

    To FAQ Table of Contents


    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]

    To FAQ Table of Contents


     

    What is M Technology?

    M Technology refers to the suite of technologies that includes the language specification, M, and related bindings and protocols.

    M Technology is a programming language, database management system and related bindings and protocols. The main features of M are:

    • A comprehensive procedural language
    • Support for object-style event-driven processing
    • An integrated hierarchical data management facility
    • Bullet-proof database security and transaction processing
    • A multi-user, multi-tasking operating environment
    • Integrated interprocess communication
    • Support for distributed data and distributed processing
    • High-performance client-server networking capabilities

    Also integrated in M Technology are:

    • Relational data manipulation tools
    • Industry-standard SQL
    • SQL-based connectivity
    • Interfaces to windowing managers
    • ANSI X3.64 standard support for character devices
    • ANSI GKS standard support for graphics devices

    Portability and scalability

    MUMPS (also known as M) is available on most platforms, including PC's and UNIX. Common capabilities are provided throughout the computer spectrum from desktop processors to enterprise-wide systems. Each M implementation is tailored to its host environment, delivering exceptional performance. The ISO standard includes statements on portability, identifying the minimum set of requirements which all M implementations must meet.

    The Language M[UMPS] has been an ANSI standard since 1977, with updates in 1984, 1990, and 1995. The identical standard has been adopted by ISO, BSI and FIPS. A worldwide M Development Committee evaluates enhancement requests and recommends improvements to the standard.

    M Technology supports new developments in computing technology - distributed databases, Windows and GUI's, SQL and client-server architecture - while the standard ensures backward compatibility.

    M has a strong emphasis on text handling and database management, with multi-user and multi-tasking support. The code is extremely compact because commands can be abbreviated, lines contain multiple commands, and each command can be associated with a separate run-time condition.

    In addition to its portability, M is popular because it is simple and direct with a relatively small command set, providing the power and flexibility of a 3GL, with the programming ease of a 4GL.

    World-wide Support for M

    M is supported by M Technology Associations located across the United States, UK, Europe (including Eastern Europe), the Pacific Rim and South America. These groups are vendor-independent with members from hardware and software vendors, academic institutions and end-users. There are also many independent local MUMPS User Groups in the United States.

    Defined at a high level, M is a comprehensive development through run-time software technology. 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
    • "Indirection:" can use strings computed at runtime as part of M program text
    • Built-in multiuser / multitasking support

    The environment includes a high-performance database and fully integrated graphical user interface. The ANSI standard M Language upon which M Technology is based shares the attributes of high productivity terseness and power found in fourth generation languages (4GLs). M also provides the benefits of open, multi-vendor platform development and industry recognized standards that are missing from traditional proprietary 4GLs.

    M's roots are in the healthcare industry. It was first developed at Massachusetts General Hospital and named MUMPS (MGH Utility Multi-Programming Systems). MUMPS became an ANSI standard in 1977. It received Federal Information Processing Standard (FIPS) approval in 1986 (FIPS 125).

    M is the most portable development language available.
    Developing a port might take six months for another language but can take less than a week for M. This portability is ensured in part by the MUMPS Development Committee's ongoing work in developing and maintaining the M standard, which is recognized by three important standard bodies: American National Standards Institute (ANSI) as ANSI/MDC X11.1/1990; the U.S. Government under the Federal Information Processing Standard (FIPS) as FIPS 125-1; and the International Organization for Standardization as ISO/IEC 11756.
    Unlike other database languages, M is nonproprietary.
    M is designed efficiently to accommodate transaction processing, database management, and distributed computing. Nearly a dozen vendors implement the M ANSI standard language on more than 200 platforms from the smallest to the largest and under every known operating system around the world. Various M tools available through independent vendors provide data dictionaries and other management functions.
    Computing's next generation, a generation of interoperability.
    This previously little-known programming language called MUMPS has become a suite of technologies with exciting computing potential. Quietly, M has grown into a strong and multifaceted contender in the information technology marketplace. As it grew, M generated a loyal following of both programmers and users. According to a recent market survey by Gartner Group, Inc., this loyalty is attributed to M's excellent reliability, database capabilities, productivity, and system availability and expandability. M's speed picked up until it rated as one of the best "bang-for-the-buck" transaction processors around. It unfolded a binding to the popular data interface SQL. And it gained an open system interconnect to put it a class ahead of other open systems today.
    M: Poised to Grow Four Times Faster Than Other Technologies
    A Gartner Group, Inc., market study found that hardware and software sales related to M products reached the $1 billion mark in 1992 and will likely reach $2 billion per year by 1995. This forecast is four times the expected growth rate of the general information technology (IT) market, which is projected to grow from $350 billion in 1991 to $480 billion in 1996. The Gartner Group based this growth in part on major developments within the M community in the areas of graphical user interfaces, networked PCs, client/server architecture, open application environments, image processing, document management, and SQL access. (The detailed survey is available from the M Technology Association)
    M: The New Technologies
    As an ANSI standard, M is updated constantly with enhancements, and approved again as a whole every few years. The latest round of enhancements to the standard has focused on adding syntax and functionality in new technologies, especially graphics, windowing, SQL, transaction processing, and open systems.

    Bindings to popular and useful industry standards allow M users to employ available technologies in concert with their M systems. Currently, bindings to SQL, X Window, graphics, and TCP are available. The M Windowing Application Program Interfaces provides another windowing option.

    April 20

    枪手的胜利

    1:0  后卫的努力 ,看来技术流的对比就是有意思
    祝福枪手
    April 19

    今天AC和巴萨对决,0:1

        虽然没有看电视,感觉ac真的有点疲惫了,后防太老了,改造还得进行;前锋线英扎吉没有上,吉拉蒂洛还是抗不住大赛的压力
    期待晚上的枪手和黄色潜水艇的对决,期待枪手的胜利

    惆怅的种子

        今天看了几个同学的blog,每个人都有那么多故事,而我自己却没有给自己留下什么 ,虽然从小不喜欢写日记 ,但是每天看自己的日子的流逝,却不知道自己的生命的真正意义是什么?心中淡出一股幽幽的伤感和惆怅。很久之前就看过一朋友 的blog,当时自己也想把心路历程记录一下 ,但是一荒废有是野草一片。来北京这么久了,心灵很少有过沟通的地方,看大学的挚友的记录,感悟一下,发现和同学现在联系好少,感觉自己失去了好多 ,满心惆怅
    April 08

    冠军杯的狂喜

    欧洲冠军杯 ,阿森纳、巴萨和ac都进入四强 ,我最喜欢的三支球队 ,心里渴望哪支球队胜利都是一种难以割舍的感觉,不过看赛程安排,我期待枪手的胜利 ,对手是西甲的比利亚雷儿,相对巴萨和ac是对手实力最少低一个档次 ,黄色潜水艇的中场核心里克儿梅在阿森纳的技术流中不一定能够出色 ,以枪手强大的火力 ,进入决赛是完全没有问题了 ,但是决赛我就有点担心了。ac 和巴萨,都是技术流的代表,球风都很类似,巴萨的梅西 小罗 和eto前场实力强大 ,ac中舍普和kaka ,还有我最喜欢的小刀英扎吉,前场实力也是剧强,现对于后防线,巴萨的实力应该没那么强硬 ,比较ac中的大佬都是意大利的精度后卫,唯一担心的后防线能否抗击住小罗等人的冲击力 ,比较如果保罗和科老年纪都一大把了
    巴萨中场哈维小白 范哥都是强人,ac的小皮 屠夫 西多夫 人还是不少的
    最后还是期待阿森纳能够抢到大耳朵,毕竟,如果亨利的离开,阿森纳就将降低一个等级
    我可是不期待看不到他们黄色的流畅的比赛
    April 13

    如何连接oracle数据库及故障解决办法-总结 (转帖)

    该文是我连接oracle的总结,特别适合于程序开发人员与oracle菜鸟
      
    如何配置才能使客户端连到数据库:
          要使一个客户端机器能连接oracle数据库,需要在客户端机器上安装oracle的客户端软件,唯一的例外就是java连接数据库的时候,可以用jdbc thin模式,不用装oracle的客户端软件。加入你在机器上装了oracle数据库,就不需要在单独在该机器上安装oracle客户端了,因为装oracle数据库的时候会自动安装oracle客户端。
          用过sql server数据库然后又用oracle的新手可能会有这样的疑问:问什么我用sql server的时候不用装sql server的客户端呢?原因很简单,sql server也是microsoft的,它在操作系统中集成了sql server客户端,如果microsoft与oracle有协议,将oracle客户端也集成到操作系统中,那我们也就不用在客户端机器装oracle客户端软机就可访问数据库了,不过,这好像是不可能实现的事情。
          也有的人会问:为什么在sql server中没有侦听端口一说,而在oracle中要配置侦听端口?其实sql server中也有侦听端口,只不过microsoft将侦听端口固定为1433,不允许你随便改动,这样给你一个错觉感觉sql server中没有侦听端口,咳,microsoft把太多的东西都封装到黑盒子里,方便使用的同时也带来的需要副作用。而oracle中的侦听端口直接在配置文件中,允许随便改动,只不过无论怎样改动,要与oracle服务器端设置的侦听端口一致。
      
    好,言归正传,我们如何做才能使客户端机器连接到oracle数据库呢?
    A.  安装相关软件
    B.  进行适当的配置
      
    A.在适当的位置安装适当的软件:
    在客户端机器:
          1.在客户端机器上安装ORACLE的Oracle Net通讯软件,它包含在oracle的客户端软件中。
          2.正确配置了sqlnet.ora文件:   
               NAMES.DIRECTORY_PATH = (TNSNAMES, ….)      
               NAMES.DEFAULT_DOMAIN=DB_DOMAIN   
             一般情况下我们不用NAMES.DEFAULT_DOMAIN参数。如果想不用该参数用#注释掉或将该参数删除即可,对于NAMES.DIRECTORY_PATH参数采用缺省值即可,对于NAMES.DEFAULT_DOMAIN参数有时需要注释掉,在下面有详细解释。
          3.正确配置了tnsname.ora文件
      
    在服务器端机器:
        1.保证listener已经启动
        2.保证数据库已经启动。
       如果数据库没有启动,用:
             Oracle 9i:
                  dos>sqlplus “/ as sysdba”
                  sqlplus> startup
            Oracle 8i:
                  dos>svrmgrl
                  svrmgrl>connect internal
                  svrmgrl>startup
           命令启动数据库
          如果listener没有启动,用:
          lsnrctl start [listener name]
          lsnrctl status [listener name]
          命令启动listener
      
    B.进行适当的配置
        如何正确配置tnsname.ora文件:
         可以在客户端机器上使用oracle Net Configuration Assistant或oracle Net Manager图形配置工具对客户端进行配置,该配置工具实际上修改tnsnames.ora文件。所以我们可以直接修改tnsnames.ora文件,下面以直接修改tnsnames.ora文件为例:
          该文件的位置为: …\network\admin\tnsnames.ora     (for windows)
               …/network/admin/tnsnames.ora     (for unix)
          此处,假设服务器名为testserver,服务名为orcl.testserver.com,使用的侦听端口为1521,则tnsnams.ora文件中的一个test网络服务名(数据库别名)为:
    test =
       (DESCRIPTION=
         (ADDRESS_LIST=
           (ADDRESS=(PROTOCOL=TCP)(HOST=testserver)(PORT=1521))
           )
         (CONNECT_DATA=(SERVICE_NAME=orcl.testserver.com)
         )
       )
       此处的笑脸为)。
       红色的内容为需要根据实际情况修改的内容,现解释如下:
        PROTOCOL:客户端与服务器端通讯的协议,一般为TCP,该内容一般不用改。
         HOST:数据库侦听所在的机器的机器名或IP地址,数据库侦听一般与数据库在同一个机器上,所以当我说数据库侦听所在的机器一般也是指数据库所在的机器。在UNIX或WINDOWS下,可以通过在数据库侦听所在的机器的命令提示符下使用hostname命令得到机器名,或通过ipconfig(for WINDOWS) or ifconfig(for UNIX)命令得到IP地址。需要注意的是,不管用机器名或IP地址,在客户端一定要用ping命令ping通数据库侦听所在的机器的机器名,否则需要在hosts文件中加入数据库侦听所在的机器的机器名的解析。
       PORT:数据库侦听正在侦听的端口,可以察看服务器端的listener.ora文件或在数据库侦听所在的机器的命令提示符下通过lnsrctl status [listener name]命令察看。此处Port的值一定要与数据库侦听正在侦听的端口一样。
       SERVICE_NAME:在服务器端,用system用户登陆后,sqlplus> show parameter service_name命令察看。
      
    如何利用配置的网络服务名连接到数据库:
         用sqlplus程序通过test网络服务名进行测试,如sqlplus system/manager@test。如果不能连接到数据库,则在tnsname.ora文件中的test网络服务名(net service)后面加上Oracle数据库的DB_Domain参数值,通过用sqlplus> show parameter db_domain命令察看。此处db_domain参数值为testserver.com,将其加到网络服务名后面,修改后的tnsname.ora中关于该网络服务名的内容为:
    test.testserver.com =
       (DESCRIPTION=
         (ADDRESS_LIST=
           (ADDRESS=(PROTOCOL=TCP)(HOST=testserver)(PORT=1521))
         )
         (CONNECT_DATA=(SERVICE_NAME=orcl.testserver.com)
         )
       )
       此处的笑脸为)。
        用sqlplus程序通过test.testserver.com网络服务名测试,如sqlplus system/manager@test.testserver.com。
      
        关于为什们在网络服务名后面加db_domain参数,需要了解sql*plus连接数据库的原理,我在后面解决12154常见故障中给出了详细的说明。
      
    如果上面的招数还不奏效的话,只好用一下乾坤大挪移了。
    将客户端的网络服务名部分
    test.testserver.com =
       (DESCRIPTION=
         (ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=testserver)(PORT=1521))
         )
         (CONNECT_DATA=(SERVICE_NAME=orcl.testserver.com)
         )
       )
    此处的笑脸为)。
         拷贝到服务器的tnsnames.ora文件中。然后再服务器端用sqlplus system/manager@test.testserver.com连接到数据库。
    如果能连接成功,说明你的客户端与服务器端的网络有问题。
         如果连接不成功,用前面的部分检查网络服务名部分部分是否正确,如果确信网络服务名部分正确而且所有的客户端都连不上数据库则可能为系统TCP/IP或Oracle系统有问题,建议重新安装数据库。
      
    常见故障解决办法:
    TNS-12154 (ORA-12154):TNS:could not resolve service name
         该错误表示用于连接的网络服务名在tnsnames.ora文件中不存在,如上面的tnsnames.ora中的网络服务名只有test,假如用户在连接时用sqlplus system/manager@test1则就会给出TNS-12154错误。
         要注意的是,有时即使在tnsnames.ora文件中有相应的网络服务名,可是用该网络服务名连接时还会出错,出现这种情况的典型配置如下(在客户端的机器上):
    sqlnet.ora文件:
          NAMES.DIRECTORY_PATH = (TNSNAMES, ….)
          NAMES.DEFAULT_DOMAIN = server.com
    tnsnames.ora文件:
          test =
             (DESCRIPTION=
                  (ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=testserver)(PORT=1521))
                  )
                 (CONNECT_DATA=(SERVICE_NAME=orcl.testserver.com)
                 )
            )
        此处的笑脸为)。
       
       sql*plus运行基本机理:
         在用户输入sqlplus system/manager@test后,sqlplus程序会自动到sqlnet.ora文件中找NAMES.DEFAULT_DOMAIN参数,假如该参数存在,则将该参数中的值取出,加到网络服务名的后面,即此例中你的输入由sqlplus system/manager@test自动变为sqlplus system/manager@test.server.com ,然后再到tnsnames.ora文件中找test.server.com网络服务名,这当然找不到了,因为该文件中只有test网络服务名,所以报错。解决的办法就是将sqlnet.ora文件中的NAMES.DEFAULT_DOMAIN参数注释掉即可,如#NAMES.DEFAULT_DOMAIN = server.com。假如NAMES.DEFAULT_DOMAIN参数不存在,则sqlplus程序会直接到tnsnames.ora文件中找test网络服务名,然后取出其中的host,port,tcp,service_name,利用这些信息将连接请求发送到正确的数据库服务器上。
         另外原则上tnsnames.ora中的配置不区分大小写,但是我的确遇到区分大小写的情况,所以最好将使用的网络服务与tnsnames.ora中配置的完全一样。
      
    ORA-12514: TNS:listener could not resolve SERVICE_NAME given in connect Descriptor.
       该错误表示能在tnsnames.ora中找到网络服务名,但是在tnsnames.ora中指定的SERVICE_NAME与服务器端的SERVICE_NAME不一致。解决的办法是修改tnsnames.ora中的SERVICE_NAME。
      
    易混淆术语介绍:
    Db_name:对一个数据库(Oracle database)的唯一标识,该数据库为第一章讲到的Oracle database。这种表示对于单个数据库是足够的,但是随着由多个数据库构成的分布式数据库的普及,这种命令数据库的方法给数据库的管理造成一定的负担,因为各个数据库的名字可能一样,造成管理上的混乱。为了解决这种情况,引入了Db_domain参数,这样在数据库的标识是由Db_name和Db_domain两个参数共同决定的,避免了因为数据库重名而造成管理上的混乱。这类似于互连网上的机器名的管理。我们将Db_name和Db_domain两个参数用’.’连接起来,表示一个数据库,并将该数据库的名称称为Global_name,即它扩展了Db_name。Db_name参数只能由字母、数字、’_’、’#’、’$’组成,而且最多8个字符。
      
    Db_domain:定义一个数据库所在的域,该域的命名同互联网的’域’没有任何关系,只是数据库管理员为了更好的管理分布式数据库而根据实际情况决定的。当然为了管理方便,可以将其等于互联网的域。
      
    Global_name:对一个数据库(Oracle database)的唯一标识,oracle建议用此种方法命令数据库。该值是在创建数据库是决定的,缺省值为Db_name. Db_domain。在以后对参数文件中Db_name与Db_domain参数的任何修改不影响Global_name的值,如果要修改Global_name,只能用ALTER DATABASE RENAME GLOBAL_NAME TO <db_name.db_domain>命令进行修改,然后修改相应参数。
      
    Service_name:该参数是oracle8i新引进的。在8i以前,我们用SID来表示标识数据库的一个实例,但是在Oracle的并行环境中,一个数据库对应多个实例,这样就需要多个网络服务名,设置繁琐。为了方便并行环境中的设置,引进了Service_name参数,该参数对应一个数据库,而不是一个实例,而且该参数有许多其它的好处。该参数的缺省值为Db_name. Db_domain,即等于Global_name。一个数据库可以对应多个Service_name,以便实现更灵活的配置。该参数与SID没有直接关系,即不必Service name 必须与SID一样。
      
    Net service name:网络服务名,又可以称为数据库别名(database alias)。是客户端程序访问数据库时所需要,屏蔽了客户端如何连接到服务器端的细节,实现了数据库的位置透明的特性。

    抱歉,我写的有错误的地方:

      Code: [Copy to clipboard]   如何利用配置的网络服务名连接到数据库:
       用sqlplus程序通过test网络服务名进行测试,如sqlplus system/manager@test。如果不能连接到数据库,则在tnsname.ora文件中的test网络服务名(net service)后面加上Oracle数据库的DB_Domain参数值,通过用sqlplus> show parameter db_domain命令察看。此处db_domain参数值为testserver.com,将其加到网络服务名后面,修改后的tnsname.ora中关于该网络服务名的内容为:


    应该改为:
    如何利用配置的网络服务名连接到数据库:
    用sqlplus程序通过test网络服务名进行测试,如sqlplus system/manager@test。如果不能连接到数据库,则在tnsname.ora文件中的test网络服务名(net service)后面加上sqlnet.ora文件中NAMES.DEFAULT_DOMAIN参数的值,此处我的参数值为testserver.com,将其加到网络服务名后面,修改后的tnsname.ora中关于该网络服务名的内容为:
      
    什么情况下会引起oracle自动设置NAMES.DEFAULT_DOMAIN参数?
       出现这种情况的典型环境为windows的客户端的‘我得电脑à属性à计算机名à更改à其它…à此计算机的主DNS后缀’中设置了‘primary dns suffix’,因为在这种情况下安装客户端时,会在sqlnet.ora文件中自动设置NAMES.DEFAULT_DOMAIN参数,或许当把计算机加入域中安装oracle客户端时也会出现这种情况,有条件的话大家可以试一下。
      
         我在设置oracle的客户端时一般手工修改tnsnames.ora文件,但是还有许多人喜欢用图形工具配置,该图形工具最终还是修改tnsnames.ora文件,但是它有时会引起其它的问题:
         在用oracle的图形配置软件'net assistant'或‘Net Configuration Assistant’配置网络服务名时,假如已经设置了‘primary dns suffix’,但是在图形配置软件中写的网络服务名的名字中没有‘primary dns suffix’,如只是写了test,则图形配置软件会自动在后面加上‘primary dns suffix’,使之变为test.testserver.com,并存在tnsnames.ora中,而不管你的sqlnet.ora文件中是否有NAMES.DEFAULT_DOMAIN参数。此时,用图形工具进行测试连接是通过的,但是假如此时sqlnet.ora文件中没有NAMES.DEFAULT_DOMAIN参数,则你在使用网络服务名时应该使用在tnsnames.ora中的test.testserver.com,而不是你在图形配置软件中键入的test。解决的办法为:
         <1>可以在sqlnet.ora文件中设置NAMES.DEFAULT_DOMAIN= testserver.com,这时你可以用test或test.testserver.com连接数据库
         <2>在sqlnet.ora文件中不设置NAMES.DEFAULT_DOMAIN参数,在tnsnames.ora文件中将test.testserver.com中的.testserver.com去掉,这时你可以用test连接数据库。