Mumps Class 16

From VistApedia
Jump to: navigation, search
Using username "worldvistaEHR".
Authenticating with public key "rsa-key-20101206"
Linux cassandra 2.6.26-1-686 #1 SMP Fri Mar 13 18:08:45 UTC 2009 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Mar 14 04:40:34 2011 from 192.168.56.44
worldvistaEHR@cassandra:~$ gtm

GTM>; $Text - continued

GTM>; What if you want to include text inside the routine, maybe as stored data

GTM>; How do you do that?

GTM>zed "KBANTEXT"

GTM>zed "KBANTEXT"

GTM>zl

GTM>zp ^KBANTEXT
KBANTEXT ; 3/14/11 10:24am
 ;;

PRINTTXT
 NEW I
 NEW TXT
 FOR I=1:1:1000000 S TXT=$TEXT(TEXT+I) Q:TXT=""  WRITE TXT
 QUIT
TEXT
 ;;THIS IS DATA STORED IN THE ROUTINE
 ;;DATA1;DATA2
 ;;DATA3;DATA4

GTM>D ^KBANTEXT
 ;;THIS IS DATA STORED IN THE ROUTINE ;;DATA1;DATA2 ;;DATA3;DATA4
GTM>; $NAME

GTM>; $NAME is a convenience function to store the name of one variable in anoth
er

GTM>; Suppose I want X to be ^TMP("SAM",$J)

GTM>; Before $Name

GTM>SET X="^TMP(""SAM"","_$J_")"

GTM>WRITE X
^TMP("SAM",2902)
GTM>SET X=$NAME(^TMP("SAM",$J))

GTM>WRITE X
^TMP("SAM",2902)
GTM>SET Y=1

GTM>SET Z="BLAH"

GTM>SET X=$NAME(^TMP("SAM",$J,Y,Z))

GTM>WRITE X
^TMP("SAM",2902,1,"BLAH")
GTM>SET @X@(1)="VALUE 1"

GTM>SET @X@(2)="VALUE 2"

GTM>ZWRITE X
X="^TMP(""SAM"",2902,1,""BLAH"")"

GTM>W X
^TMP("SAM",2902,1,"BLAH")
GTM>ZWRITE @X
%GTM-E-GVUNDEF, Global variable undefined: ^TMP("SAM",2902,1,"BLAH")
                At M source location +1^GTM$DMOD

GTM>ZWRITE ^TMP("SAM",2902,1,"BLAH",*)
^TMP("SAM",2902,1,"BLAH",1)="VALUE 1"
^TMP("SAM",2902,1,"BLAH",2)="VALUE 2"

GTM>SET X=^TMP("SAM",$J,Y,Z)
%GTM-E-GVUNDEF, Global variable undefined: ^TMP("SAM",2902,1,"BLAH")

GTM>; $RANDOM

GTM>; Gives you a random number from 0 to arg-1

GTM>w $Random(99)
47
GTM>w $Random(33)
6
GTM>; $reverse

GTM>; Reverses a string

GTM>S X="ABCDEF"

GTM>W $REVERSE(X)
FEDCBA
GTM>; Clever uses of $reverse

GTM>S X=$NA(SAM(1,2,3,4,5,6,7))

GTM>W X
SAM(1,2,3,4,5,6,7)
GTM>; $NA IS $NAME

GTM>; forget this example

GTM>; this one

GTM>S X=/tmp/root/blah.gg/file.txt
%GTM-E-EXPR, Expression expected but not found
        S X=/tmp/root/blah.gg/file.txt
            ^-----

GTM>S X="/tmp/root/blah.gg/file.txt"

GTM>W $P($RE(X),"/")
txt.elif
GTM>W $RE($P($RE(X),"/"))
file.txt
GTM>W $P(X,"/",$L(X,"/"))
file.txt
GTM>; $SELECT

GTM>ZED "RAORD"

GTM>ZED "RAORDU"

GTM>ZED "RAORDU"

GTM>zed "RAORDU"

GTM>; $SELECT is a case statement in Mumps

GTM>; Except it all goes on one line!!!

GTM>; Syntax

GTM>; WRITE $SELECT(<CONDITION>:<VALUE>,<CONDITION>:<VALUE>...,[1:<DEFAULT>])

GTM>; If you don't include the default, you cause an error in Mumps

GTM>; If you don't include the default, you cause an error in Mumps if there is
no match

GTM>; VISTA SAC requires you to put a default.

GTM>S Y=1

GTM>S Z=0

GTM>WRITE $SELECT(Y:"Hello 1",Z:"Hello 2",1:"Bye")
Hello 1
GTM>S Z=1

GTM>WRITE $SELECT(Y:"Hello 1",Z:"Hello 2",1:"Bye")
Hello 1
GTM>S Y=0

GTM>WRITE $SELECT(Y:"Hello 1",Z:"Hello 2",1:"Bye")
Hello 2
GTM>S Z=0

GTM>WRITE $SELECT(Y:"Hello 1",Z:"Hello 2",1:"Bye")
Bye
GTM>WRITE $SELECT(Y:"Hello 1",Z:"Hello 2")
%GTM-E-SELECTFALSE, No argument to $SELECT was true

GTM>W $EC
,M7,Z150372994,
GTM>W $ECODE
,M7,Z150372994,
GTM>; $FNUMBER

GTM>; relation to $Justify

GTM>; $FNUMBER is almost never used in VISTA

GTM>; Formats numbers

GTM>W $FN(-42,"p")
(42)
GTM>W $FN(42,"p")
 42
GTM>W $l($FN(42,"p"))
4
GTM>; pads the 42 if not negative

GTM>W $FN(-42,"t")
42-
GTM>W $FN(42000,",")
42,000
GTM>W $FN(42000,"p,")
 42,000
GTM>W $FN(-42000,"p,")
(42,000)
GTM>W $FN(42000,"+")
+42000
GTM>W $FN(42000,"-")
42000
GTM>W $FN(-42000,"-")
42000
GTM>W $FN(-42000,"p,",2)
(42,000.00)
GTM>; $Justify

GTM>W $J(-42000,0,2)
-42000.00
GTM>W $J(-42000,10,2)
 -42000.00
GTM>W $J(-42000,15,2)
      -42000.00
GTM>; $justify 3 arg form does the same thing as 3 arg form of $fnumber

GTM>; Halt

GTM>; abbreviated as H without arguments

GTM>; exits and mumps process normally

GTM>; exits mumps process normally

GTM>; Hang

GTM>; abbreviated as H with an argument

GTM>; Hang is equivalent to Thread.Sleep

GTM>; except you give it seconds, not milliseconds

GTM>e.g.
%GTM-E-SPOREOL, Either a space or an end-of-line was expected but not found
        e.g.
         ^-----

GTM>; e.g.

GTM>H 5  ; sleep for 5 seconds

GTM>FOR I=1:1 WRITE "HELLO",! H 1
HELLO
HELLO
HELLO
HELLO
HELLO
HELLO
HELLO
HELLO
HELLO
%GTM-I-CTRLC, CTRL_C encountered

GTM>; Goto

GTM>zed "KBANGOTO"

GTM>zl

GTM>zp ^KBANGOGO
%GTM-E-ZLINKFILE, Error while zlinking "KBANGOGO"
%GTM-E-FILENOTFND, File KBANGOGO not found

GTM>zp ^KBANGOTO
KBANGOTO ; 3/14/11 10:56am
 GOTO THERE
 WRITE "I am here",!
THERE
 WRITE "I am there",!

GTM>D ^KBANGOTO
I am there

GTM>ZED

GTM>zl
         GOTO THERE2(1,2,3)
                    ^-----
                At column 13, line 2, source module /opt/worldvista/EHR/p/KBANGOTO.m
%GTM-E-SPOREOL, Either a space or an end-of-line was expected but not found

GTM>ZP ^KBANGOTO
KBANGOTO ; 3/14/11 10:57am
 GOTO THERE2(1,2,3)
 WRITE "I am here",!
THERE
 WRITE "I am there",!
THERE2(A,B,C)
 WRITE A+B+C


GTM>; Goto can only go to labels, not to formal lines (formal lines are labels w
ith parameter lists)

GTM>; Merge

GTM>; M

GTM>; Merge is a new introduction to Mumps (1990 standard). It copies one array
over to another.

GTM>; Merge is a new introduction to Mumps (1990 standard). It copies one array
GTM>e.g.
%GTM-E-SPOREOL, Either a space or an end-of-line was expected but not found
        e.g.
         ^-----

GTM>; e.g.

GTM>zwrite ^TMP($J,*)

GTM>D NEWPERS^ORWU(.SAM,"A",1)
%GTM-E-UNDEF, Undefined local variable: DT
                At M source location ALL+6^VASITE

GTM>D ^XUP

Setting up programmer environment
This is a TEST account.

Access Code:
EHR:cassandra>D ^XUP

Setting up programmer environment
This is a TEST account.

Access Code: ********
EHR:cassandra>D NEWPERS^ORWU(.SAM,"A",1)

EHR:cassandra>ZWRITE SAM
SAM(1)="14^Administrator,System"
SAM(2)="65^Analyst,One^- ANALYST"
SAM(3)="66^Analyst,Three^- ANALYST"
SAM(4)="69^Analyst,Two^- ANALYST"
SAM(5)="47^Clerk,Eight^- Medical Clerk"
SAM(6)="50^Clerk,Eleven^- Medical Clerk"
SAM(7)="54^Clerk,Fifteen^- Medical Clerk"
SAM(8)="44^Clerk,Five^- Medical Clerk"
SAM(9)="43^Clerk,Four^- Medical Clerk"
SAM(10)="53^Clerk,Fourteen^- Medical Clerk"
SAM(11)="48^Clerk,Nine^- Medical Clerk"
SAM(12)="46^Clerk,Seven^- Medical Clerk"
SAM(13)="45^Clerk,Six^- Medical Clerk"
SAM(14)="49^Clerk,Ten^- Medical Clerk"
SAM(15)="52^Clerk,Thirteen^- Medical Clerk"
SAM(16)="42^Clerk,Three^- Medical Clerk"
SAM(17)="51^Clerk,Twelve^- Medical Clerk"
SAM(18)="41^Clerk,Two^- Medical Clerk"
SAM(19)="58^Coordinator,Clinical^- CLINICAL COORDINATOR"
SAM(20)="9^Coordinator,Five^- ANALYST"
SAM(21)="3^Coordinator,Four"
SAM(22)="2^Coordinator,Nine"
SAM(23)="63^Coordinator,One^- ANALYST"
SAM(24)="64^Coordinator,Seven"
SAM(25)="60^Coordinator,Six^- CLINICAL COORDINATOR"
SAM(26)="67^Coordinator,Three^- ANALYST"
SAM(27)="68^Coordinator,Two^- ANALYST"
SAM(28)="21^Doctor,Eight^- Physician"
SAM(29)="24^Doctor,Eleven^- Physician"
SAM(30)="18^Doctor,Five^- Physician"
SAM(31)="17^Doctor,Four^- Physician"
SAM(32)="22^Doctor,Nine^- Physician"
SAM(33)="11^Doctor,One^- Physician"
SAM(34)="20^Doctor,Seven^- Physician"
SAM(35)="19^Doctor,Six^- Physician"
SAM(36)="23^Doctor,Ten^- Physician"
SAM(37)="16^Doctor,Three^- Physician"
SAM(38)="26^Doctor,Twelve^- Physician"
SAM(39)="15^Doctor,Two^- Physician"
SAM(40)="62^Lab,Superuser^- ANALYST"
SAM(41)="8^Manager,System^- System Manager"
SAM(42)="33^Nurse,Eight^- Nurse"
SAM(43)="36^Nurse,Eleven^- Nurse"
SAM(44)="40^Nurse,Fifteen^- Nurse"

EHR:cassandra>MERGE ^TMP("SAM",$J)=SAM

EHR:cassandra>ZWRITE ^TMP("SAM",$J)
%GTM-E-GVUNDEF, Global variable undefined: ^TMP("SAM",2902)

EHR:cassandra>ZWRITE ^TMP("SAM",$J,*)
^TMP("SAM",2902,1)="14^Administrator,System"
^TMP("SAM",2902,1,"BLAH",1)="VALUE 1"
^TMP("SAM",2902,1,"BLAH",2)="VALUE 2"
^TMP("SAM",2902,2)="65^Analyst,One^- ANALYST"
^TMP("SAM",2902,3)="66^Analyst,Three^- ANALYST"
^TMP("SAM",2902,4)="69^Analyst,Two^- ANALYST"
^TMP("SAM",2902,5)="47^Clerk,Eight^- Medical Clerk"
^TMP("SAM",2902,6)="50^Clerk,Eleven^- Medical Clerk"
^TMP("SAM",2902,7)="54^Clerk,Fifteen^- Medical Clerk"
^TMP("SAM",2902,8)="44^Clerk,Five^- Medical Clerk"
^TMP("SAM",2902,9)="43^Clerk,Four^- Medical Clerk"
^TMP("SAM",2902,10)="53^Clerk,Fourteen^- Medical Clerk"
^TMP("SAM",2902,11)="48^Clerk,Nine^- Medical Clerk"
^TMP("SAM",2902,12)="46^Clerk,Seven^- Medical Clerk"
^TMP("SAM",2902,13)="45^Clerk,Six^- Medical Clerk"
^TMP("SAM",2902,14)="49^Clerk,Ten^- Medical Clerk"
^TMP("SAM",2902,15)="52^Clerk,Thirteen^- Medical Clerk"
^TMP("SAM",2902,16)="42^Clerk,Three^- Medical Clerk"
^TMP("SAM",2902,17)="51^Clerk,Twelve^- Medical Clerk"
^TMP("SAM",2902,18)="41^Clerk,Two^- Medical Clerk"
^TMP("SAM",2902,19)="58^Coordinator,Clinical^- CLINICAL COORDINATOR"
^TMP("SAM",2902,20)="9^Coordinator,Five^- ANALYST"
^TMP("SAM",2902,21)="3^Coordinator,Four"
^TMP("SAM",2902,22)="2^Coordinator,Nine"
^TMP("SAM",2902,23)="63^Coordinator,One^- ANALYST"
^TMP("SAM",2902,24)="64^Coordinator,Seven"
^TMP("SAM",2902,25)="60^Coordinator,Six^- CLINICAL COORDINATOR"
^TMP("SAM",2902,26)="67^Coordinator,Three^- ANALYST"
^TMP("SAM",2902,27)="68^Coordinator,Two^- ANALYST"
^TMP("SAM",2902,28)="21^Doctor,Eight^- Physician"
^TMP("SAM",2902,29)="24^Doctor,Eleven^- Physician"
^TMP("SAM",2902,30)="18^Doctor,Five^- Physician"
^TMP("SAM",2902,31)="17^Doctor,Four^- Physician"
^TMP("SAM",2902,32)="22^Doctor,Nine^- Physician"
^TMP("SAM",2902,33)="11^Doctor,One^- Physician"
^TMP("SAM",2902,34)="20^Doctor,Seven^- Physician"
^TMP("SAM",2902,35)="19^Doctor,Six^- Physician"
^TMP("SAM",2902,36)="23^Doctor,Ten^- Physician"
^TMP("SAM",2902,37)="16^Doctor,Three^- Physician"
^TMP("SAM",2902,38)="26^Doctor,Twelve^- Physician"
^TMP("SAM",2902,39)="15^Doctor,Two^- Physician"
^TMP("SAM",2902,40)="62^Lab,Superuser^- ANALYST"
^TMP("SAM",2902,41)="8^Manager,System^- System Manager"
^TMP("SAM",2902,42)="33^Nurse,Eight^- Nurse"
^TMP("SAM",2902,43)="36^Nurse,Eleven^- Nurse"
^TMP("SAM",2902,44)="40^Nurse,Fifteen^- Nurse"

EHR:cassandra>; Before the existence of the Merge command,

EHR:cassandra>; VISTA used a routine called %RCR

EHR:cassandra>; And it's still used (cry)

EHR:cassandra>; $Horolog ($H)

EHR:cassandra>; Time in Mumps format

EHR:cassandra>d ^%D
14-MAR-11
EHR:cassandra>d ^%T
11:15 AM
EHR:cassandra>W $HOROLOG
62164,40558
EHR:cassandra>W 40558/60/60
11.2661111111111111
EHR:cassandra>; 11.26 is almost 11:15

EHR:cassandra>w 62164/365.24
170.200416164713612
EHR:cassandra>; 170 years after 1841

EHR:cassandra>W 1841+170
2011
EHR:cassandra>; Different from Fileman Date

EHR:cassandra>; Conversion functions to and from $H can be found in %DT and XLFD
T

EHR:cassandra>; esp $$HTFM^XLFDT

EHR:cassandra>WRITE $$HTFM^XLFDT($H)
3110314.111919
EHR:cassandra>WRITE $$FMTE^XLFDT($$HTFM^XLFDT($H))
Mar 14, 2011@11:19:38
EHR:cassandra>; $H is not a function

EHR:cassandra>; It's an instrinsic variable

EHR:cassandra>; the difference b/n functions and intrinsic variables is that

EHR:cassandra>; functions take arguments; variables don't

EHR:cassandra>; More instrinsic variables

EHR:cassandra>; $JOB

EHR:cassandra>; Job number - in GT.M it stands for process number

EHR:cassandra>; number that uniquely identifies the current mumps process

EHR:cassandra>; commonly used in garbage globals

EHR:cassandra>; like ^TMP("PS",$J)

EHR:cassandra>; $X and $Y

EHR:cassandra>; represents coordinates of cursor on the screen

EHR:cassandra>w $X
0
EHR:cassandra>w $Y
1
EHR:cassandra>S $Y=0

EHR:cassandra>W $X
0
EHR:cassandra>S $X=55

EHR:cassandra>ZWRITE
C=" "
DILOCKTM=3
DISYS=19
DT=3110314
DTIME=300
DUZ=0
DUZ(0)=""
DUZ(1)=""
DUZ(2)=67
DUZ("AG")="E"
DUZ("LANG")=""
IO(0)="/dev/pts/1"
ORY(1)="14^Administrator,System"
ORY(2)="65^Analyst,One^- ANALYST"
ORY(3)="66^Analyst,Three^- ANALYST"
ORY(4)="69^Analyst,Two^- ANALYST"
ORY(5)="47^Clerk,Eight^- Medical Clerk"
ORY(6)="50^Clerk,Eleven^- Medical Clerk"
ORY(7)="54^Clerk,Fifteen^- Medical Clerk"
ORY(8)="44^Clerk,Five^- Medical Clerk"
ORY(9)="43^Clerk,Four^- Medical Clerk"
ORY(10)="53^Clerk,Fourteen^- Medical Clerk"
ORY(11)="48^Clerk,Nine^- Medical Clerk"
ORY(12)="46^Clerk,Seven^- Medical Clerk"
ORY(13)="45^Clerk,Six^- Medical Clerk"
ORY(14)="49^Clerk,Ten^- Medical Clerk"
ORY(15)="52^Clerk,Thirteen^- Medical Clerk"
ORY(16)="42^Clerk,Three^- Medical Clerk"
ORY(17)="51^Clerk,Twelve^- Medical Clerk"
ORY(18)="41^Clerk,Two^- Medical Clerk"
ORY(19)="58^Coordinator,Clinical^- CLINICAL COORDINATOR"
ORY(20)="9^Coordinator,Five^- ANALYST"
ORY(21)="3^Coordinator,Four"
ORY(22)="2^Coordinator,Nine"
ORY(23)="63^Coordinator,One^- ANALYST"
ORY(24)="64^Coordinator,Seven"
ORY(25)="60^Coordinator,Six^- CLINICAL COORDINATOR"
ORY(26)="67^Coordinator,Three^- ANALYST"
ORY(27)="68^Coordinator,Two^- ANALYST"
ORY(28)="21^Doctor,Eight^- Physician"
ORY(29)="24^Doctor,Eleven^- Physician"
ORY(30)="18^Doctor,Five^- Physician"
ORY(31)="17^Doctor,Four^- Physician"
ORY(32)="22^Doctor,Nine^- Physician"
ORY(33)="11^Doctor,One^- Physician"
ORY(34)="20^Doctor,Seven^- Physician"
ORY(35)="19^Doctor,Six^- Physician"
ORY(36)="23^Doctor,Ten^- Physician"
ORY(37)="16^Doctor,Three^- Physician"
ORY(38)="26^Doctor,Twelve^- Physician"
ORY(39)="15^Doctor,Two^- Physician"
ORY(40)="62^Lab,Superuser^- ANALYST"
ORY(41)="8^Manager,System^- System Manager"
ORY(42)="33^Nurse,Eight^- Nurse"
ORY(43)="36^Nurse,Eleven^- Nurse"
ORY(44)="40^Nurse,Fifteen^- Nurse"
*SAM=ORY
U="^"
VASITE=1
VASITE("050")="050"

EHR:cassandra>K

EHR:cassandra>D ^XUP

Setting up programmer environment
This is a TEST account.

Access Code: ********
EHR:cassandra>ZWRITE
DILOCKTM=3
DISYS=19
DT=3110314
DTIME=300
DUZ=0
DUZ(0)=""
DUZ(1)=""
DUZ(2)=67
DUZ("AG")="E"
DUZ("LANG")=""
IO(0)="/dev/pts/1"
*SAM=ORY
U="^"

EHR:cassandra>ZWRITE ^ZOSF
%GTM-E-GVUNDEF, Global variable undefined: ^ZOSF

EHR:cassandra>ZWRITE ^%ZOSF
^%ZOSF("$INC")=0
^%ZOSF("ACTJ")="S Y=$$ACTJ^%ZOSV()"
^%ZOSF("AVJ")="S Y=$$AVJ^%ZOSV()"
^%ZOSF("BRK")="U $I:(CENABLE)"
^%ZOSF("DEL")="D DEL^%ZOSV2(X) ;N %RD,%OD S %RD=$P($S($ZRO[""("":$P($P($ZRO,""("
          ",2),"")""),1:$ZRO),"" "")_""/"",%OD=$S($ZRO[""("":$P($ZRO,""("",1)_""
          /"",1:%RD) ZSYSTEM ""rm -f ""_%RD_X_"".m"" ZSYSTEM ""rm -f ""_%OD_X_""
          .o"""
^%ZOSF("EOFF")="U $I:(NOECHO)"
^%ZOSF("EON")="U $I:(ECHO)"
^%ZOSF("EOT")="S Y=$ZA\1024#2 ; <====="
^%ZOSF("ERRTN")="^%ZTER"
^%ZOSF("ETRP")="Q"
^%ZOSF("GD")="G ^%GD"
^%ZOSF("JOBPARAM")="G JOBPAR^%ZOSV"
^%ZOSF("LABOFF")="U IO:(NOECHO) ; <====="
^%ZOSF("LOAD")="D LOAD^%ZOSV2(X) ;S %N=0 F XCNP=XCNP+1:1 S %N=%N+1,%=$T(+%N^@X)
          Q:$L(%)=0  S @(DIF_XCNP_"",0)"")=%"
^%ZOSF("LPC")="S Y="""" ; <====="
^%ZOSF("MAGTAPE")="S %MT(""BS"")=""*1"",%MT(""FS"")=""*2"",%MT(""WTM"")=""*3"",%
          MT(""WB"")=""*4"",%MT(""REW"")=""*5"",%MT(""RB"")=""*6"",%MT(""REL"")=
          ""*7"",%MT(""WHL"")=""*8"",%MT(""WEL"")=""*9"" ; <====="
^%ZOSF("MAXSIZ")="Q"
^%ZOSF("MGR")="EHR,EHR"
^%ZOSF("MTBOT")="S Y=$ZA\32#2 ; <====="
^%ZOSF("MTERR")="S Y=$ZA\32768#2 ; <====="
^%ZOSF("MTONLINE")="S Y=$ZA\64#2 ; <====="
^%ZOSF("MTWPROT")="S Y=$ZA\4#2 ; <====="
^%ZOSF("NBRK")="U $I:(NOCENABLE)"
^%ZOSF("NO-PASSALL")="U $I:(ESCAPE:TERMINATOR="""":NOPASTHRU)"
^%ZOSF("NO-TYPE-AHEAD")="U $I:(NOTYPEAHEAD)"
^%ZOSF("OS")="GT.M (Unix)^19"
^%ZOSF("PASSALL")="U $I:(NOESCAPE:NOTERMINATOR:PASTHRU)"
^%ZOSF("PRIINQ")="S Y=$$PRIINQ^%ZOSV()"
^%ZOSF("PRIORITY")="Q  ;G PRIORITY^%ZOSV"
^%ZOSF("PROD")="EHR,EHR"
^%ZOSF("PROGMODE")="S Y=$$PROGMODE^%ZOSV()"
^%ZOSF("RD")="G ^%RD"
^%ZOSF("RESJOB")="Q:'$D(DUZ)  Q:'$D(^XUSEC(""XUMGR"",+DUZ))  N XQZ S XQZ=""^FORC
          EX[MGR]"" D DO^%XUCI ; <====="
^%ZOSF("RM")="U $I:WIDTH=$S(X<256:X,1:0)"
^%ZOSF("RSEL")="K ^UTILITY($J) D ^%RSEL S X="""" X ""F  S X=$O(%ZR(X)) Q:X="""""
          """  S ^UTILITY($J,X)="""""""""" K %ZR"
^%ZOSF("RSUM")="S Y=0 F %=1,3:1 S %1=$T(+%^@X),%3=$F(%1,"" "") Q:'%3  S %3=$S($E
          (%1,%3)'="";"":$L(%1),$E(%1,%3+1)="";"":$L(%1),1:%3-2) F %2=1:1:%3 S Y
          =$A(%1,%2)*%2+Y"
^%ZOSF("RSUM1")="N %,%1,%2,%3 S Y=0 F %=1,3:1 S %1=$T(+%^@X),%3=$F(%1,"" "") Q:'
          %3  S %3=$S($E(%1,%3)'="";"":$L(%1),$E(%1,%3+1)="";"":$L(%1),1:%3-2) F
           %2=1:1:%3 S Y=$A(%1,%2)*(%2+%)+Y"
^%ZOSF("SAVE")="D SAVE^%ZOSV2(X) ;N %I,%F S %I=$I,%F=$P($S($ZRO[""("":$P($P($ZRO
          ,""("",2),"")""),1:$ZRO),"" "")_""/""_X_"".m"" O %F:(NEWVERSION) U %F
          X ""F  S XCN=$O(@(DIE_XCN_"""")"""")) Q:+XCN'=XCN  S %=@(DIE_XCN_"""",
          0)"""") Q:$E(%,1)=""""$""""  I $E(%)'="""";"""" W %,!"" C %F U %I"
^%ZOSF("SIZE")="S Y=0 F I=1:1 S %=$T(+I) Q:%=""""  S Y=Y+$L(%)+2 ; <====="
^%ZOSF("SS")="D ^ZSY"
^%ZOSF("TEST")="I X]"""",$T(^@X)]"""""
^%ZOSF("TMK")="S Y=$ZA\16384#2"
^%ZOSF("TMP")="/tmp/"
^%ZOSF("TRAP")="$ZT=""G ""_X"
^%ZOSF("TRMOFF")="U $I:(TERMINATOR="""")"
^%ZOSF("TRMON")="U $I:(TERMINATOR=$C(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17
          ,18,19,20,21,22,23,24,25,26,27,28,29,30,31,127))"
^%ZOSF("TRMRD")="S Y=$A($ZB)"
^%ZOSF("TYPE-AHEAD")="U $I:(TYPEAHEAD)"
^%ZOSF("UCI")="S Y=^%ZOSF(""PROD"")"
^%ZOSF("UCICHECK")="S Y=1"
^%ZOSF("UPPERCASE")="S Y=$TR(X,""abcdefghijklmnopqrstuvwxyz"",""ABCDEFGHIJKLMNOP
          QRSTUVWXYZ"")"
^%ZOSF("VOL")="EHR"
^%ZOSF("XY")="S $X=DX,$Y=DY ; <====="
^%ZOSF("ZD")="S Y=$$HTE^XLFDT(X,2) I $L($P(Y,""/""))=1 S Y=0_Y"

EHR:cassandra>S DX=6,DY=Y X ^%ZOSF("XY")
%GTM-E-UNDEF, Undefined local variable: Y

EHR:cassandra>S DX=6,DY=8 X ^%ZOSF("XY")

EHR:cassandra>W *27,"c"

EHR:cassandra>S DX=6,DY=8 X ^%ZOSF("XY")

EHR:cassandra>; not working for me

EHR:cassandra>; $QUIT

EHR:cassandra>zed

EHR:cassandra>zed "KBANQUIT"

EHR:cassandra>zl

EHR:cassandra>zp ^KBANQUIT
KBANQUIT ; 3/14/11 11:30am
 ;;
EN1
 W "$QUIT IS ",$QUIT
 Q
EN2
 W "$QUIT IS ",$QUIT
 Q "HELLO"

EHR:cassandra>D EN1^KBANQUIT
$QUIT IS 0
EHR:cassandra>W $$EN1^KBANQUIT
%GTM-E-FMLLSTMISSING, The formal list is absent from a label called with an actual list:

EHR:cassandra>W $$EN1^KBANQUIT()
%GTM-E-FMLLSTMISSING, The formal list is absent from a label called with an actual list:

EHR:cassandra>ZED

EHR:cassandra>zl

EHR:cassandra>W $$EN2^KBANQUIT()
$QUIT IS 1HELLO
EHR:cassandra>d EN2^KBANQUIT()
$QUIT IS 0%GTM-E-NOTEXTRINSIC, Quit does not return to an extrinsic function: argument not allowed
                At M source location EN2+2^KBANQUIT

EHR:cassandra>zg

EHR:cassandra>zed

EHR:cassandra>zl

EHR:cassandra>zp ^KBANQUIT
KBANQUIT ; 3/14/11 11:33am
 ;;
EN1
 W "$QUIT IS ",$QUIT
 Q
EN2()
 W "$QUIT IS ",$QUIT
 ; If $QUIT is 1, we are being called as a function ($$)
 ; therefore, quit needs to quit with an argument
 QUIT:$QUIT "Hello"
 ; If $QUIT is 0, we are being called by a DO
 ; therefore, we need to quit with no arguemnts.
 QUIT:'$QUIT

EHR:cassandra>D EN2^KBANQUIT
%GTM-E-ACTLSTEXP, Actuallist expected
                At M source location EN2^KBANQUIT

EHR:cassandra>D EN2^KBANQUIT()
$QUIT IS 0
EHR:cassandra>W $$EN2^KBANQUIT()
$QUIT IS 1Hello
EHR:cassandra>W $$EN1^KBANQUIT()
%GTM-E-FMLLSTMISSING, The formal list is absent from a label called with an actual list:

EHR:cassandra>W $$EN1^KBANQUIT
%GTM-E-FMLLSTMISSING, The formal list is absent from a label called with an actual list:

EHR:cassandra>ZED

EHR:cassandra>zl
%GTM-E-LOADRUNNING, Cannot ZLINK an active routine KBANQUIT

EHR:cassandra>zg

EHR:cassandra>zl

EHR:cassandra>zp ^KBANQUIT
KBANQUIT ; 3/14/11 11:35am
 ;;
EN1()
 W "$QUIT IS ",$QUIT
 Q
EN2()
 W "$QUIT IS ",$QUIT
 ; If $QUIT is 1, we are being called as a function ($$)
 ; therefore, quit needs to quit with an argument
 QUIT:$QUIT "Hello"
 ; If $QUIT is 0, we are being called by a DO
 ; therefore, we need to quit with no arguemnts.
 QUIT:'$QUIT

EHR:cassandra>W $$EN1^KBANQUIT()
$QUIT IS 1
%GTM-E-QUITARGREQD, Quit from an extrinsic must have an argument

EHR:cassandra>D EN1^KBANQUIT()
$QUIT IS 0
EHR:cassandra>; $IO AND $PRINCIPLE

EHR:cassandra>; $I & $P

EHR:cassandra>; $P is the principle device

EHR:cassandra>; the device that started the mumps process

EHR:cassandra>WRITE $P
/dev/pts/1
EHR:cassandra>; $IO stands for the current device

EHR:cassandra>; ^%ZIS

EHR:cassandra>d ^%ZIS

DEVICE: HOME// chris  CHRIS

EHR:cassandra>ZWRITE IO
IO="|PRN|CHRIS"
IO(0)="/dev/pts/1"
IO(1,"/dev/pts/1")=""
IO(1,"|PRN|CHRIS")=""
IO("ERROR")=""
IO("HOME")="50^/dev/pts/1"

EHR:cassandra>W $I
/dev/pts/1
EHR:cassandra>W $P
/dev/pts/1
EHR:cassandra>USE IO

EHR:cassandra>W $I

EHR:cassandra>W "HELLO"

EHR:cassandra>C IO

EHR:cassandra>W $I
/dev/pts/1
EHR:cassandra>o "/tmp/sam.txt"

EHR:cassandra>u "/tmp/sam.txt"

EHR:cassandra>W $I

EHR:cassandra>W !

EHR:cassandra>W "Hello"

EHR:cassandra>c "/tmp/sam.txt"

EHR:cassandra>zsy "cat /tmp/sam.txt"
/tmp/sam.txt
Hello

EHR:cassandra>w $P
/dev/pts/1
EHR:cassandra>; $key, $device, $zb

EHR:cassandra>; $key says what terminated the last read

EHR:cassandra>; $device tells you if there is a problem in IO with the current d
evice. 0 is good; 1 is bad

EHR:cassandra>; $zb tells you the termination of escape sequences of the last re
ad

EHR:cassandra>W $KEY

EHR:cassandra>W $DEVICE

EHR:cassandra>W +$DEVICE
0
EHR:cassandra>W $ZB

EHR:cassandra>U $P:break
%GTM-E-DEVPARUNK, Deviceparameter unknown

EHR:cassandra>U $P:escape

EHR:cassandra>R *X

EHR:cassandra>W $ZB
U
EHR:cassandra>R *X

EHR:cassandra>W X
27
EHR:cassandra>U $P:(ESCAPE)

EHR:cassandra>R *X

EHR:cassandra>W X
27
EHR:cassandra>W $ZB

EHR:cassandra>R *X

EHR:cassandra>W $ZB
T
EHR:cassandra>; SSVNs

EHR:cassandra>; Not supported by GT.M but they are part of the Mumps standard

EHR:cassandra>; ^$ROUTINE; ^$LOCK, ^$CHARACTER

EHR:cassandra>