Mumps Class 3
From VistApedia
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: Thu Jan 6 17:11:18 2011 from 192.168.56.1 worldvistaEHR@cassandra:~$ gtm GTM>; Variables start with a letter or % GTM>; rest of variables can be letters or numbers. GTM>; Variables can be up to 16 letters long GTM>; Basic Commands: GTM>; Set, Write, Read (S, W, R) GTM>; + GTM>WRITE 3+4 7 GTM>WRITE 3.1+4 7.1 GTM>; Incremeting GTM>S X=0 GTM>S X=X+1 GTM>W X 1 GTM>; - GTM>WRITE 4-3 1 GTM>WRITE 3-4 -1 GTM>WRITE 3.1-4 -.9 GTM>; Decrementing GTM>S X=X-1 GTM>W X 0 GTM>S X=X-1 GTM>W X -1 GTM>; * GTM>W 3*4 12 GTM>W 3.2*4 12.8 GTM>W 3.200000 3.2 GTM>W 3.200000*4 12.8 GTM>; / GTM>W 3/4 .75 GTM>W 4/3 1.33333333333333333 GTM>W 4/3*3 3.99999999999999999 GTM>; \ GTM>; Integer Division GTM>W 4\3 1 GTM>W 7\3 2 GTM>W 7/-3 -2.33333333333333333 GTM>W 7\-3 -2 GTM>W 20\7 2 GTM>; # modulo GTM>W 20#7 6 GTM>; ** power GTM>W 3**2 9 GTM>W 3**3 27 GTM>W 3**4 81 GTM>W 3**.5 1.73205080756887712 GTM>; Binary operators for numbers GTM>; Next: Urnary operators GTM>; +, -, ' GTM>; + -> Change string to number GTM>; even if it is not a number GTM>; Numbers have a canonical form in Mumps: GTM>; No zeros before the decimal; no zeros after the decimal if there is no other digit after the z ero GTM>W 00000000003 3 GTM>W 3.223000000000 3.223 GTM>; Rules for converting strings GTM>; If strings starts with number, use that number. GTM>; if string doesn't start with a number, it will be zero. GTM>W +"30 MEADOW ROAD" 30 GTM>W +"HELLO" 0 GTM>W +"" 0 GTM>I $G(VAR) W "HELLO" GTM>W $G(VAR) GTM>W $G(VAR)=="" %GTM-E-RHMISSING, Right-hand side of expression expected W $G(VAR)=="" ^----- GTM>W $G(VAR)="" 1 GTM>W +$G(VAR) 0 GTM>ZWRITE ^DPT(3,*) ^DPT(3,0)="ZZ PATIENT,TEST THREE^M^2680115^^7^^UNEMPLOYED^^^^MIAMI^12^^^^^^^^1" ^DPT(3,.11)="123 ANYWHERE^^^AVON^18^46123^7^^^^^46123^3050724.173752^VAMC^050^^59" ^DPT(3,.21)="CLAUSE,SANTA^FRIEND^^^^^^^^N" ^DPT(3,.24)="^^NITWIT," ^DPT(3,.3)="N^^^^^^^^^^^" ^DPT(3,.31)="^^^^^^^^^^N" ^DPT(3,.311)="^^^^^^^^^^^^^^9" ^DPT(3,.32)="^^98" ^DPT(3,.36)="10^^--" ^DPT(3,1010)="3^^^^^^^^3050509.0907^RED^" ^DPT(3,"DIS",0)="^2.101DA^6949489.9093^1" ^DPT(3,"DIS",6949489.9093,0)="3050509.0907^1^3^2^9^^^^^1^5^^10^0^0" ^DPT(3,"DIS",6949489.9093,2)="N^^^N" ^DPT(3,"E",0)="^2.0361P^10^1" ^DPT(3,"E",10,0)="10^^--^" ^DPT(3,"E","B",10,10)="" ^DPT(3,"LR")=3 ^DPT(3,"MPI")="500000002^140241^24^1" ^DPT(3,"NAME")="76^68" ^DPT(3,"S",0)="^2.98P^3110106.093^48" ^DPT(3,"S",3100111.0815,0)="2^^^^^^3^^^^^^^^^9^^^3100114.092542" ^DPT(3,"S",3100111.09,0)="2^C^^^^^3^^^^^23^^3100114.0925^10^9^^23^3100113" ^DPT(3,"S",3100111.1,0)="2^^^^^^3^^^^^^^^^9^^^3100113.084626" ^DPT(3,"S",3100123.09,0)="2^^^^^^3^^^^^^^^^9^^^3101023.233802" ^DPT(3,"S",3100919.09,0)="1^^^^^^3^^^^^^^^^9^^^3100916.102431" ^DPT(3,"S",3100920.0845,0)="2^C^^^^^3^^^^^23^^3100915.1814^10^9^^23^3100915" ^DPT(3,"S",3100920.0915,0)="2^^^^^^3^^^^^^^^^9^^^3100915.202231" ^DPT(3,"S",3100920.093,0)="2^^^^^^3^^^^^^^^^9^^^3100915.184746" ^DPT(3,"S",3100920.0945,0)="2^^^^^^3^^^^^^^^^9^^^3100915.195028" ^DPT(3,"S",3100920.1,0)="2^^^^^^3^^^^^^^^^9^^^3100915.202222" ^DPT(3,"S",3100920.103,0)="2^^^^^^3^^^^^^^^^9^^^3100915.202305" ^DPT(3,"S",3100920.1045,0)="2^C^^^^^3^^^^^23^^3100915.2024^11^9^^23^3100915" ^DPT(3,"S",3100921.103,0)="2^^^^^^3^^^^^^^^^9^^^3100915.20241" ^DPT(3,"S",3100922.0845,0)="2^^^^^^3^^^^^^^^^9^^^3100915.185524" ^DPT(3,"S",3100922.0915,0)="2^^^^^^3^^^^^^^^^9^^^3100915.195408" ^DPT(3,"S",3100922.093,0)="2^C^^^^^3^^^^^23^^3100915.1817^10^9^^23^3100915" ^DPT(3,"S",3100922.0945,0)="2^^^^^^3^^^^^^^^^9^^^3100915.195343" ^DPT(3,"S",3100922.1,0)="2^^^^^^3^^^^^^^^^9^^^3100915.202448" ^DPT(3,"S",3100922.1015,0)="2^C^^^^^3^^^^^23^^3100915.2021^11^9^^23^3100915" ^DPT(3,"S",3100922.1045,0)="2^^^^^^3^^^^^^^^^9^^^3100915.202156" ^DPT(3,"S",3101206.0256,0)="2^^^^^^3^^^^^^^^^9^^^3101206.025656" ^DPT(3,"S",3101206.0304,0)="2^^^^^^3^^^^^^^^^9^^^3101206.030416" ^DPT(3,"S",3101206.0305,0)="2^^^^^^3^^^^^^^^^9^^^3101206.030527" ^DPT(3,"S",3101206.0307,0)="2^^^^^^3^^^^^^^^^9^^^3101206.030706" ^DPT(3,"S",3101206.0647,0)="2^N^^^^^3^^^^^23^^3101206.064737^^9^^^3101206.064737" ^DPT(3,"S",3101206.0728,0)="2^N^^^^^3^^^^^9^^3101206.07283^^9^^^3101206.07283" ^DPT(3,"S",3101206.0731,0)="2^N^^^^^3^^^^^9^^3101206.073128^^9^^^3101206.073128" ^DPT(3,"S",3101206.0737,0)="2^^^^^^3^^^^^^^^^9^^^3101206.073703" ^DPT(3,"S",3101206.0739,0)="2^^^^^^3^^^^^^^^^9^^^3101206.073955" ^DPT(3,"S",3101206.074,0)="2^^^^^^3^^^^^^^^^9^^^3101206.074" ^DPT(3,"S",3101206.0741,0)="2^^^^^^3^^^^^^^^^9^^^3101206.074104" ^DPT(3,"S",3101206.0742,0)="2^^^^^^3^^^^^^^^^9^^^3101206.074205" ^DPT(3,"S",3101206.0744,0)="2^^^^^^3^^^^^^^^^9^^^3101206.074408" ^DPT(3,"S",3101206.0802,0)="2^^^^^^3^^^^^^^^^9^^^3101206.080222" ^DPT(3,"S",3101206.0803,0)="2^^^^^^3^^^^^^^^^9^^^3101206.080332" ^DPT(3,"S",3101206.0814,0)="2^^^^^^3^^^^^^^^^9^^^3101206.081415" ^DPT(3,"S",3101206.0816,0)="2^^^^^^3^^^^^^^^^9^^^3101206.081658" ^DPT(3,"S",3101206.0817,0)="2^^^^^^3^^^^^^^^^9^^^3101206.081704" ^DPT(3,"S",3101206.0818,0)="2^^^^^^3^^^^^^^^^9^^^3101206.081816" ^DPT(3,"S",3101206.1156,0)="2^^^^^^3^^^^^^^^^9^^^3101206.11562" ^DPT(3,"S",3101206.1219,0)="2^N^^^^^3^^^^^11^^3101206.121901^^9^^^3101206.121901" ^DPT(3,"S",3101206.1221,0)="2^^^^^^3^^^^^^^^^9^^^3101206.12211" ^DPT(3,"S",3101206.1227,0)="2^N^^^^^3^^^^^11^^3101206.122759^^9^^^3101206.122759" ^DPT(3,"S",3101206.1248,0)="2^N^^^^^3^^^^^11^^3101206.124839^^9^^^3101206.124839" ^DPT(3,"S",3110106.093,0)="4^^^^^^4^^^^^^^^^9^^^3110106.090646" ^DPT(3,"S",3110123.09,0)="2^^^^^^3^^^^^^^^^9^^^3101031.093646" ^DPT(3,"S",3110123.093,0)="2^^^^^^3^^^^^^^^^9^^^3101031.101933" ^DPT(3,"S",3110123.094,0)="2^PC^^^^^3^^^^^9^^3101031.1043^1^9^^9^3101031" ^DPT(3,"S",3110123.094,"R")="Sam's Reason" ^DPT(3,"TYPE")=15 ^DPT(3,"VET")="N" GTM>W ^DPT(3,"MPI") 500000002^140241^24^1 GTM>W +^DPT(3,"MPI") 500000002 GTM>; - GTM>; Make a number negative GTM>; ' GTM>; NOT GTM>S X=1 GTM>W 'X 0 GTM>S X=5 GTM>W 'X 0 GTM>W ''X 1 GTM>; ' Changes expression to boolean GTM>IF X W "HELLO" HELLO GTM>W X 5 GTM>IF ''X W "HELLO" HELLO GTM>; ' frequently stops looping GTM>SET Y="" FOR SET Y=$ORDER(^DPT(Y)) QUIT:'Y WRITE ^DPT(Y,0) GTM>SET Y=0 FOR SET Y=$ORDER(^DPT(Y)) QUIT:'Y WRITE ^DPT(Y,0) ZZ PATIENT,TEST ONE^F^2450124^^2^^NOE^^000003322^^LAS VEGAS^32^^^68^3060511^^^^1ZZ PATIENT,TEST TWO^ M^2571225^^7^^SAILOR^29^^Test patient only, please use to test, train^BOSTON^25^^^^^^^^1ZZ PATIENT,T EST THREE^M^2680115^^7^^UNEMPLOYED^^^^MIAMI^12^^^^^^^^1MOUSE,MICKEY^M^2311120^^2^^ACTOR^^^^ORLANDO^1 2^^^^^^^^1DUCK,DONALD^M^2831203^^2^^ACTOR^^^^AMMAN^90^^^^^^^^1GOOSE,GOOFY^M^2820929^^2^^^104^3030929 82P^^NESPELEM^53^^^23^3100214^^^^1MOUSE,MINNIE^F^2650423^^2^^ACTRESS^^505042365P^^AMMAN^90^^^23^3100 214^^^^1LISA,MONA DA^F^2371111^^2^^PAINTER SUBJECT^^524111137P^^ROMA^93^^^23^3100214^^^^1MCDUCK,SCRO OGE^M^2331122^^^^^^^^^^^^^^^^^1RED NOSE,RUDOLPH^M^2331122^^^^^^^^^^^^^^^^^1WHITE,SNOW^F^2331122^^^^^ ^123458902^^^^^^9^3100318^^^^1BUNNY,BUGS^M^3011122^^^^^^^^^^^^^^^^^1RUNNER,ROAD^F^2801122^^^^^^^^^^^ ^^^^^^1WILE,COYOTE E^M^2331122^^^^^^^^^^^^^^^^^1MOORE,MANDY^F^2881122^^^^^^^^^^^^^^^^^1MARTIAN,THE^M ^2330122^^^^^^^^^^^^^^^^^1MOON,SAILOR^F^2800000^^^^^^^^^^^^^^^^^1MOON,PLUTO^F^2800000^^^^^^^^^^^^^^^ ^^1MARS,SAILOR^M^2900000^^^^^^^^^^^^^^^^^1BIRD,TWEETIE^F^2881207^^^^^^^^^^^^^^^^^1THECAT,TOM^M^28007 07^^^^^^^^^^^^^^^^^1POOH,WINNIE THE^M^2221101^^^^^^^^^^^^^^^^^1MICHIRO,AOI^F^2881111^^^^^^^^^^^^^^^^ ^1 GTM>SET Y=0 FOR SET Y=$ORDER(^DPT(Y)) QUIT:'Y WRITE ^DPT(Y,0),! ZZ PATIENT,TEST ONE^F^2450124^^2^^NOE^^000003322^^LAS VEGAS^32^^^68^3060511^^^^1 ZZ PATIENT,TEST TWO^M^2571225^^7^^SAILOR^29^^Test patient only, please use to test, train^BOSTON^25^ ^^^^^^^1 ZZ PATIENT,TEST THREE^M^2680115^^7^^UNEMPLOYED^^^^MIAMI^12^^^^^^^^1 MOUSE,MICKEY^M^2311120^^2^^ACTOR^^^^ORLANDO^12^^^^^^^^1 DUCK,DONALD^M^2831203^^2^^ACTOR^^^^AMMAN^90^^^^^^^^1 GOOSE,GOOFY^M^2820929^^2^^^104^303092982P^^NESPELEM^53^^^23^3100214^^^^1 MOUSE,MINNIE^F^2650423^^2^^ACTRESS^^505042365P^^AMMAN^90^^^23^3100214^^^^1 LISA,MONA DA^F^2371111^^2^^PAINTER SUBJECT^^524111137P^^ROMA^93^^^23^3100214^^^^1 MCDUCK,SCROOGE^M^2331122^^^^^^^^^^^^^^^^^1 RED NOSE,RUDOLPH^M^2331122^^^^^^^^^^^^^^^^^1 WHITE,SNOW^F^2331122^^^^^^123458902^^^^^^9^3100318^^^^1 BUNNY,BUGS^M^3011122^^^^^^^^^^^^^^^^^1 RUNNER,ROAD^F^2801122^^^^^^^^^^^^^^^^^1 WILE,COYOTE E^M^2331122^^^^^^^^^^^^^^^^^1 MOORE,MANDY^F^2881122^^^^^^^^^^^^^^^^^1 MARTIAN,THE^M^2330122^^^^^^^^^^^^^^^^^1 MOON,SAILOR^F^2800000^^^^^^^^^^^^^^^^^1 MOON,PLUTO^F^2800000^^^^^^^^^^^^^^^^^1 MARS,SAILOR^M^2900000^^^^^^^^^^^^^^^^^1 BIRD,TWEETIE^F^2881207^^^^^^^^^^^^^^^^^1 THECAT,TOM^M^2800707^^^^^^^^^^^^^^^^^1 POOH,WINNIE THE^M^2221101^^^^^^^^^^^^^^^^^1 MICHIRO,AOI^F^2881111^^^^^^^^^^^^^^^^^1 GTM>SET Y=0 FOR SET Y=$ORDER(^DPT(Y)) WRITE Y,! QUIT:'Y 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 AAP GTM>W '"23" 0 GTM>W '"AAP" 1 GTM>W +"APP" 0 GTM>W '+"APP" 1 GTM>; GTM>; Comparison operators GTM>; Output comparison operators is always boolean GTM>; 1 or 0 GTM>; Less than GTM>WRITE 3<4 1 GTM>WRITE 4<3 0 GTM>WRITE 4<=3 %GTM-E-RHMISSING, Right-hand side of expression expected WRITE 4<=3 ^----- GTM>; Mumps has no less than or equal. Use instead "Not Greater than" GTM>WRITE 4'>3 0 GTM>; Same as less than or equal GTM>; More than GTM>WRITE 4>3 1 GTM>WRITE 3>4 0 GTM>WRIET 4'<3 %GTM-E-INVCMD, Invalid command keyword encountered WRIET 4'<3 ^----- GTM>WRITE 4'<3 1 GTM>; 4 greater than or equal GTM>WRITE 4'<4 1 GTM>; 4 greater than or equal to 4 GTM>; = GTM>; Equal sign used for both assignment and comparison in Mumps GTM>; no == GTM>; Mumps uses Equal for assignment only in Set command GTM>; Otherwise, Equal is used for comparison GTM>; Equal compares strings, not numbers GTM>WRITE "HELLO"="NOT HELLO" 0 GTM>WRITE "3.000"="3" 0 GTM>WRITE 3.0000=3 1 GTM>; Mumpc converts 3.0000 to 3 first in the act of storage before continuing. GTM>; [ GTM>; Contains GTM>WRITE "HELLO"["E" 1 GTM>WRITE "E"["HELLO" 0 GTM>WRITE "HELLO"["LLO" 1 GTM>WRITE "HELLO"["LLOO" 0 GTM>; ] GTM>; follows GTM>WRITE "B"]"A" 1 GTM>WRITE "A"]"B" 0 GTM>WRITE "B">"A" 0 GTM>; follows comapares strings; > compares numbers GTM>; Follows almost never used, except in one context GTM>; "following" an empty string. GTM>; Actually a shorthand for not equal GTM>W X 5 GTM>; Is X empty? GTM>W X]"" 1 GTM>; Is X NOT empty? GTM>W X]"" 1 GTM>W X'="" 1 GTM>ZED "DI" GTM>W X'="" 1 GTM>; ? - expression matching (not quite regular expressions) GTM>W "33"?1.3N 1 GTM>W "33"?3.4N 0 GTM>; Does "33" match (1) 1 - 3 numbers or (2) 3 - 4 numbers? GTM>; Logical operators GTM>; & - AND GTM>; ! - OR GTM>; ' - NOT GTM>S A=1,B=0 GTM>W A&B 0 GTM>W A!B 1 GTM>W A&'B 1 GTM>; Routine name is 8 letters long GTM>ZEDIT "KJOHCIRC" GTM>; HW: GTM>; 1. Calculate the circumference of a circle whose radius is 12.5 GTM>; 2. Read the radius from the user, and calculate circumference GTM>; 3. If the circumference is less than zero, output zero instead of a negative number GTM>ZEDIT "KJOHCIRC" GTM>zlink "KJOHCIRC" GTM>D ^KJOHCIRC CIRCUMFERENCE OF A CIRCLE WITH RADIUS OF 12.5: 78.5 GTM>ZEDIT "KJOHCIRC" GTM>zl GTM>zl GTM>D ^KJOHCIRC CIRCUMFERENCE OF A CIRCLE WITH RADIUS OF 12.5: 78.5 GTM>ZPRINT ^KJOHCIRC KJOHCIRC ; 1/7/11 12:02pm ; ; HW1 WRITE "CIRCUMFERENCE OF A CIRCLE WITH RADIUS OF 12.5: ",! WRITE 2*3.14*12.5 GTM>