Mumps Class 8
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: Tue Jan 25 04:24:57 2011 from 192.168.56.1 worldvistaEHR@cassandra:~$ gtm GTM>D ^%T 4:49 AM GTM>D ^%D 25-JAN-11 GTM>ZED "KBANFOR" GTM>zl GTM>zp ^KBANFOR KBANFOR ; Routine to show For loops ; 1/25/11 4:53am ;; FOR1 ; Simplest For Loop ; from 1 to 10 step 1 FOR I=1:1:10 WRITE I,! ; from 1 to 10 step 2 WRITE ! FOR I=1:2:10 WRITE I,! ; from 10 to 1 step -1 WRITE ! FOR I=10:-1:1 WRITE I,! GTM>D FOR1^KBANFOR 1 2 3 4 5 6 7 8 9 10 1 3 5 7 9 10 9 8 7 6 5 4 3 2 1 GTM>ZED GTM>zp FOR2:FOR2+5 GTM>zp FOR2^KBANFOR:FOR2+5 %GTM-E-ZPRTLABNOTFND, Label not found in routine GTM>ZL GTM>zp FOR2^KBANFOR:FOR2+5 FOR2 ; For over a list of items SET A=1,B=3,C=5 FOR X=A,B,C WRITE X QUIT GTM>D FOR2^KBANFOR 135 GTM>ZED GTM>zl GTM>zp FOR3^KBANFOR:FOR3+10 FOR3 ; For with a Do command SET LTRNUM=0 ; Letter Number FOR X="A","B","C","D","E","F","G","H" DO . WRITE "X is: ",X . WRITE ! . SET LTRNUM=LTRNUM+1 . WRITE "Letter Number is: ",LTRNUM QUIT GTM>D FOR3^KBANFOR X is: A Letter Number is: 1X is: B Letter Number is: 2X is: C Letter Number is: 3X is: D Letter Number is: 4X is: E Letter Number is: 5X is: F Letter Number is: 6X is: G Letter Number is: 7X is: H Letter Number is: 8 GTM>ZED GTM>zl GTM>zp FOR3^KBANFOR:FOR3+10 FOR3 ; For with a Do command SET LTRNUM=0 ; Letter Number FOR X="A","B","C","D","E","F","G","H" DO . WRITE "X is: ",X . WRITE ?20 . SET LTRNUM=LTRNUM+1 . WRITE "Letter Number is: ",LTRNUM,! QUIT GTM>D FOR3^KBANFOR X is: A Letter Number is: 1 X is: B Letter Number is: 2 X is: C Letter Number is: 3 X is: D Letter Number is: 4 X is: E Letter Number is: 5 X is: F Letter Number is: 6 X is: G Letter Number is: 7 X is: H Letter Number is: 8 GTM>zed GTM>zl GTM>zp FOR4^KBANFOR:FOR4+10 FOR4 ; For with a Quit inside the for loop SET LTRNUM=0 ; Letter Number FOR X="A","B","C","D","E","F","G","H" DO . SET LTRNUM=LTRNUM+1 . IF LTRNUM#2 QUIT ;We don't like odd numbers, so we stop. . WRITE "X is: ",X . WRITE ?20 . WRITE "Letter Number is: ",LTRNUM,! QUIT GTM>D FOR4^KBANFOR X is: B Letter Number is: 2 X is: D Letter Number is: 4 X is: F Letter Number is: 6 X is: H Letter Number is: 8 GTM>; The quit inside the for loop acts as a continue. GTM>; There is NO, NO, NO break command to get out of a loop GTM>zed GTM>zl GTM>D FOR5^KBANFOR X is: B Letter Number is: 2 X is: D Letter Number is: 4 X is: F Letter Number is: 6 GTM>zl GTM>zp FOR5^KBANFOR:FOR5+5 FOR5 ; For with a Quit inside the for loop SET LTRNUM=0 ; Letter Number FOR X="A","B","C","D","E","F","G","H" DO QUIT:LTRNUM>6 . SET LTRNUM=LTRNUM+1 . IF LTRNUM#2 QUIT ;We don't like odd numbers, so we stop. GTM>zp FOR5^KBANFOR:FOR5+10 FOR5 ; For with a Quit inside the for loop SET LTRNUM=0 ; Letter Number FOR X="A","B","C","D","E","F","G","H" DO QUIT:LTRNUM>6 . SET LTRNUM=LTRNUM+1 . IF LTRNUM#2 QUIT ;We don't like odd numbers, so we stop. . WRITE "X is: ",X . WRITE ?20 . WRITE "Letter Number is: ",LTRNUM,! QUIT GTM>D FOR5^KBANFOR X is: B Letter Number is: 2 X is: D Letter Number is: 4 X is: F Letter Number is: 6 GTM>; Quit on a For line terminates the for loop GTM>zed GTM>zl %GTM-E-LABELMISSING, Label referenced but not defined: QUIT %GTM-I-SRCNAM, in source module /opt/worldvista/EHR/p/KBANFOR.m GTM>zed GTM>zl GTM>zed GTM>zl FOR I=1:1 QUIT:NUM>5 DO ; I is 1 step 1, no end ^----- At column 23, line 51, source module /opt/worldvista/EHR/p/KBANFOR.m %GTM-E-QUITARGUSE, Quit cannot take an argument in this context GTM>; Quit needs to get 2 spaces GTM>zed GTM>zl GTM>ZED GTM>zl GTM>zp FOR6^KBANFOR:FOR6+10 FOR6 ; For; Quit command location SET NUM=1 FOR I=1:1 QUIT:NUM>5 DO ; I is 1 step 1, no end . SET NUM=NUM*2 . WRITE "NUM is: ",NUM,! QUIT GTM>D FOR6^KBANFOR NUM is: 2 NUM is: 4 NUM is: 8 GTM>; How come it printed 8?? GTM>; Because the Quit happens after the multiplication takes place GTM>zed GTM>zl GTM>zp FOR7^KBANFOR:FOR7+10 FOR7 ; For and quit, try 2 SET NUM=1 FOR I=1:1 QUIT:NUM>5 DO . WRITE "Num is: ",NUM,! . SET NUM=NUM*2 QUIT GTM>D FOR7^KBANFOR Num is: 1 Num is: 2 Num is: 4 GTM>ZED GTM>zl GTM>zp FOR8^KBANFOR:FOR8+10 FOR8 ; For; Quit command location; prints 2, 4, 8 SET NUM=1 FOR I=1:1 DO QUIT:NUM>5 ; I is 1 step 1, no end . SET NUM=NUM*2 . QUIT:NUM>5 . WRITE "NUM is: ",NUM,! QUIT GTM>D FOR8^KBANFOR NUM is: 2 NUM is: 4 GTM>; Quit before the Do in a for loop acts like a while loop in C GTM>; Quit after the Do in a for loop acts like a do/while loop in C GTM>zed GTM>zl GTM>zp FOR9^KBANFOR:FOR9+10 FOR9 ; For, infinite loops FOR WRITE "HELLO" ; for with no arguments is an infinite loop FOR I=0:0 WRITE "HELLO" ; Step is zero, but no end. FOR I=1:1 WRITE "HELLO" ; Step is 1, but no end either. QUIT GTM>zed GTM>zl GTM>zp FOR10^KBANFOR:FOR10+15 FOR10 ; A use for infinite loops S DONE=0 FOR DO QUIT:DONE . WRITE "Pick a menu option, or type ""Q"" to quit",! . WRITE ! . WRITE "1. Option 1" . WRITE "2. Option 2" . WRITE "3. Option 3" . WRITE ! . READ "Enter Option: ",X . IF X="Q" SET DONE=1 QUIT . WRITE "Doing something with what the user picked",! . WRITE # ; Form feed; clears the screen QUIT GTM>D FOR10^KBANFOR Pick a menu option, or type "Q" to quit 1. Option 12. Option 23. Option 3 Enter Option: %GTM-I-CTRLC, CTRL_C encountered GTM>ZG GTM>zed GTM>zl GTM>zp FOR10^KBANFOR:FOR10+15 FOR10 ; A use for infinite loops S DONE=0 FOR DO QUIT:DONE . WRITE "Pick a menu option, or type ""Q"" to quit",! . WRITE ! . WRITE "1. Option 1",! . WRITE "2. Option 2",! . WRITE "3. Option 3",! . WRITE ! . READ "Enter Option: ",X . IF X="Q" SET DONE=1 QUIT . WRITE "Doing something with what the user picked",! . WRITE # ; Form feed; clears the screen QUIT GTM>D FOR10^KBANFOR Pick a menu option, or type "Q" to quit 1. Option 1 2. Option 2 3. Option 3 Enter Option: 1Doing something with what the user picked Pick a menu option, or type "Q" to quit 1. Option 1 2. Option 2 3. Option 3 Enter Option: 2Doing something with what the user picked Pick a menu option, or type "Q" to quit 1. Option 1 2. Option 2 3. Option 3 Enter Option: Q GTM>; HW: Explain what a significant chunk of a routine does!!!!!!!! GTM>zed "_DT" GTM>zed "XMS" GTM>; XMS -> Abu AbuRuzz GTM>zed "ORKPS" GTM>; GLCREAT^ORKPS -> Murat GTM>zed "XUSRB" GTM>; VALIDAV^XUSRB -> Abu Dayyeh GTM>zed "ORB3TIM1" GTM>; NPO^ORB3TIM1 -> Ayman GTM>zed "ORB3TIM2" GTM>; EXPIR^ORB3TIM2 -> Hiba (Poor Hiba) GTM>zed "XMRPOP" GTM>; ENTRY^XMRPOP -> Rami GTM>; Here is what to do for your homework. GTM>; Copy the routine to a decent place GTM>; And start commenting the routine explaining what each line does. GTM>