Mumps Class 15

 Using username "sw-dev". sw-dev@172.16.16.108's password: Linux swdev 2.6.31-20-generic #58-Ubuntu SMP Fri Mar 12 05:23:09 UTC 2010 i686

To access official Ubuntu documentation, please visit: http://help.ubuntu.com/

236 packages can be updated. 197 updates are security updates.

Last login: Tue Mar 15 09:25:08 2011 from ayman-laptop.local sw-dev@swdev:/var/worldvista/sw/dev$ ls backup  journals  log      old-localr   tmp bin     localo    md5sum   replication  vista-login-msg globals localr    objects  routines     vista-state sw-dev@swdev:/var/worldvista/sw/dev$ mumps -dir mumps: command not found sw-dev@swdev:/var/worldvista/sw/dev$ $gtm_dist/mumps -dir

sw-dev> ; Indirection

sw-dev> ; Indirection in general is the substitution of a string with a language expression

sw-dev> ; E.g.

sw-dev> SET X="Y"

sw-dev> SET Y=5

sw-dev> WRITE X Y sw-dev> WRITE Y 5 sw-dev> ; What if you want to treat what's in X as a variable?

sw-dev> WRITE @X 5 sw-dev> ; Another example

sw-dev> ; What if you want to set a variable you don't know at compile time?

sw-dev> ; What if you receive that variable from somewhere at run time?

sw-dev> S VAR="PATIENT"

sw-dev> S VALUE=5

sw-dev> S @VAR=VALUE

sw-dev> W PATIENT 5 sw-dev> ; @ sign, when appended to a string in Read, write, or set converts a st ring to a variable.

sw-dev> ; Next form of indirection

sw-dev> ; Argument indirection

sw-dev> ; works with Set and $text

sw-dev> SET X=5

sw-dev> SET EXPRESSION="X=5"

sw-dev> WRITE EXPRESSION X=5 sw-dev> SET EXPRESSION="X=200"

sw-dev> WRITE EXPRESSION X=200 sw-dev> SET @EXPRESSION

sw-dev> WRITE X 200 sw-dev> WRITE EXPRESSION X=200 sw-dev> WRITE @EXPRESSION 1 sw-dev> WRITE X=200 1 sw-dev> SET EXPRESSION="+1^XUP"

sw-dev> WRITE EXPRESSION +1^XUP sw-dev> WRITE @EXPRESSION %GTM-E-INDEXTRACHARS, Indirection string contains extra trailing characters +1^XUP ^-

sw-dev> WRITE +1^XUP %GTM-E-SPOREOL, Either a space or an end-of-line was expected but not found WRITE +1^XUP ^-

sw-dev> WRITE $TEXT(@EXPRESSION) XUP ;SFISC/RWF - Setup enviroment for programmers ;10/12/06 12:45 sw-dev> ZBREAK ^XUP

sw-dev> ZSHOW "B" ^XUP

sw-dev> D ^XUP %GTM-I-BREAKZBA, Break instruction encountered during ZBREAK action At M source location XUP+2^XUP

sw-dev> ZSTEP INTO

Setting up programmer environment%GTM-I-BREAKZST, Break instruction encountered during ZSTEP action At M source location XUP+3^XUP

sw-dev> SET $ZSTEP="WRITE $TEXT(@$ZPOSITION),! BREAK"

sw-dev> WRITE $ZPOSITION XUP+3^XUP sw-dev> WRITE $TEXT($ZPOSITION) %GTM-E-TEXTARG, Invalid argument to $TEXT function WRITE $TEXT($ZPOSITION) ^-

sw-dev> WRITE $ZPOSITION="XUP+3^XUP" 1 sw-dev> ; Convert string to argument using '@'

sw-dev> WRITE $TEXT(@$ZPOS) S U="^",$ECODE="",$ETRAP="" ;Clear error and error trap sw-dev>

sw-dev> ; Yet another form of the '@'

sw-dev> ; @ for pattern indirection

sw-dev> WRITE "ABC"?.E 1 sw-dev> WRITE "ABC"?4.E 0 sw-dev> ; You can store the pattern as a string, then indirect it

sw-dev> SET PATTERN="4.E"

sw-dev> WRITE "ABC"?@PATTERN 0 sw-dev> WRITE "ABC"?PATTERN %GTM-E-PATCODE, Illegal syntax for pattern WRITE "ABC"?PATTERN ^-

sw-dev> WRITE "ABC"?@PATTERN 0 sw-dev> ; Last form of '@' is Subscript Indirection

sw-dev> ; Created specifically for VISTA

sw-dev> ; How does this work?

sw-dev> ; Let's say that you have a very long variable name, with lots of changi ng subscripts

sw-dev> S MYVAR="^TMP(""TEST"",$J)"

sw-dev> WRITE MYVAR ^TMP("TEST",$J) sw-dev> ; Do something like this:

sw-dev> ; Set ^TMP("TEST",$J,1)="Hello"

sw-dev> SET @($E(MYVAR,1,$L(MYVAR)-1)_",1)")="Hello"

sw-dev> WRITE ^TMP("TEST",$J,1) Hello sw-dev> SET @MYVAR@(1)="Hello"

sw-dev> WRITE ^TMP("TEST",$J,1) Hello sw-dev> SET @MYVAR@(1)="Hello2"

sw-dev> WRITE ^TMP("TEST",$J,1) Hello2 sw-dev> WRITE ^TMP("TEST",$J) %GTM-E-GVUNDEF, Global variable undefined: ^TMP("TEST",26130)

sw-dev> WRITE ^TMP("TEST",$J)@(1) %GTM-E-SPOREOL, Either a space or an end-of-line was expected but not found WRITE ^TMP("TEST",$J)@(1) ^-

sw-dev> SET Y=8

sw-dev> SET Y(1)="HLWKE"

sw-dev> SET Y(1,2)="YEST"

sw-dev> WRITE Y(1) HLWKE sw-dev> WRITE Y(1)(2) %GTM-E-SPOREOL, Either a space or an end-of-line was expected but not found WRITE Y(1)(2) ^-

sw-dev> WRITE Y(1)@(2) %GTM-E-SPOREOL, Either a space or an end-of-line was expected but not found WRITE Y(1)@(2) ^-

sw-dev> S X="Y(1)"

sw-dev> W @X@(2) YEST sw-dev> S X="Y"

sw-dev> W @X@(1,2) YEST sw-dev> ; Xecute command

sw-dev> ; X

sw-dev> X "WRITE HELLO" %GTM-E-UNDEF, Undefined local variable: HELLO At M source location XUP+3^XUP

sw-dev> X "WRITE ""HELLO""" HELLO sw-dev> X "SET X=10,Y=20,Z=30"

sw-dev> WRITE X,!,Y,!,Z 10 20 30 sw-dev> WRITE ^%ZVEMS NEW FLAGQ,VEE S FLAGQ=0 D ^%ZVEMSY Q:FLAGQ KILL FLAGQ X ^%ZVEMS("ZS",1) NEW VEE SHC,VEESHL S VEESHL="RUN" F X ^%ZVEMS("ZA",1) I $G(VEESHC)="^" X:$D(^%ZVEMS("ZK ",1)) ^(1) Q:VEESHC'="NO EXIT" sw-dev> DO "WRITE X,!,Y,!Z" %GTM-E-LABELEXPECTED, Label expected in this context DO "WRITE X,!,Y,!Z" ^-

sw-dev> XECUTE ^%ZVEMS

-- Your DUZ isn't defined. I'm calling ^XUP. -- %GTM-I-BREAKZBA, Break instruction encountered during ZBREAK action At M source location XUP+2^XUP

sw-dev> ZC

Setting up programmer environment This is a TEST account.

Access Code: ******** Terminal Type set to: C-VT102

You have 38 new messages. Select OPTION NAME:

=
=============< I D  N U M B E R >========================== Enter your VShell ID number. Your User QWIK commands will not be accessible if your ID is incorrect.

For first time users: Your ID number can be a number from .1 to 999999, 2 decimal digits. It can match your DUZ number but it doesn't have to. The VShell will use your ID to store data that pertains only to you. If VA KERNEL routine ^XUP is not in this UCI, you will need to enter your ID number each time you enter the VShell from this UCI.

=
============================================================

=
============< D I S C L A I M E R >========================= IN NO EVENT WILL I, THE DEVELOPER OF THIS SOFTWARE, BE LIABLE FOR DIRECT, INCIDENTAL, INDIRECT, SPECIAL, OR CONSEQUENTIAL DAMAGES RESULTING FROM ANY DEFECT IN THIS SOFTWARE OR ITS DOCUMENTATION OR ARISING OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE OR ACCOMPANYING DOCUMENTATION. DAVID BOLDUC

=
============================================================

Enter ID Number: 111//

TERMINAL TYPE: C-VT102 If your screen is now in Reverse Video, the REVERSE VIDEO OFF field in the TERMINAL TYPE file may not be correct for your terminal type. This will adversely effect some VSHELL screens and should be corrected. Type 'W $C(27,91,109)' if you need to return your screen to normal.

VPE. . . Victory Programmer Environment. . . . . . . . . . . . David Bolduc ^,H,HALT=Quit  ?=Help   1,2=User QWIKs   3,4=System QWIKs

>>H sw-dev> ; Using Xecute to implement a Programmer mode shell

sw-dev> READ "CMD>",X,! X X CMD>WRITE "HELLO" HELLO sw-dev> FOR READ "CMD>",X,! XECUTE X CMD>WRITE "HELLO" HELLOCMD> CMD> CMD> %GTM-I-CTRLC, CTRL_C encountered

sw-dev> FOR READ "CMD>",X,! XECUTE X WRITE ! CMD>WRITE "HELLO" HELLO CMD>ZWRITE ^SAM ^SAM="منستيب,منت مسنتب منستيب^Male^3040915.0000^JOR^^^JOR ALABAMA^^^1231123123^^         ^ISLAM^NEVER MARRIED^^NO^^Father^JOR ALABAMA^^^^^سيب,سيب^NO^1231231231          ^^1231231231^NO^NO^^^" ^SAM(1)="منستيب,منت مسنتب منستيب" ^SAM(2)="Male" ^SAM(3)="3040915.0000" ^SAM(4)="JOR" ^SAM(5)="" ^SAM(6)="" ^SAM(7)="JOR ALABAMA" ^SAM(8)="" ^SAM(9)="" ^SAM(10)=1231123123 ^SAM(11)="" ^SAM(12)="" ^SAM(13)="ISLAM" ^SAM(14)="NEVER MARRIED" ^SAM(15)="" ^SAM(16)="NO" ^SAM(17)="" ^SAM(18)="Father" ^SAM(19)="JOR ALABAMA" ^SAM(20)="" ^SAM(21)="" ^SAM(22)="" ^SAM(23)="" ^SAM(24)="سيب,سيب" ^SAM(25)="NO" ^SAM(26)=1231231231 ^SAM(27)="" ^SAM(28)=1231231231 ^SAM(29)="NO" ^SAM(30)="NO" ^SAM(31)="" ^SAM(32)="" ^SAM(33)="" ^SAM("V",1)="%=""172.16.16.88""" ^SAM("V",2)="DILOCKTM=3" ^SAM("V",3)="DISYS=19" ^SAM("V",4)="DT=3100919" ^SAM("V",5)="DTIME=30" ^SAM("V",6)="DUZ=0" ^SAM("V",7)="DUZ(0)=""""" ^SAM("V",8)="ERR=0" ^SAM("V",9)="IO=""/dev/null""" ^SAM("V",10)="IO(0)=""/dev/null""" ^SAM("V",11)="IO(1,""/dev/null"")=""""" ^SAM("V",12)="IO(""ERROR"")=""""" ^SAM("V",13)="IO(""GTM-IP"")=""172.16.16.88""" ^SAM("V",14)="IO(""HOME"")=""47^/dev/null""" ^SAM("V",15)="IO(""IP"")=""172.16.19.73""" ^SAM("V",16)="IOBS=""$C(8)""" ^SAM("V",17)="IOF=""#""" ^SAM("V",18)="IOHG=""""" ^SAM("V",19)="IOM=132" ^SAM("V",20)="ION=""NULL""" ^SAM("V",21)="IOPAR=""""" ^SAM("V",22)="IOS=47" ^SAM("V",23)="IOSL=64" ^SAM("V",24)="IOST=""P-OTHER""" ^SAM("V",25)="IOST(0)=16" ^SAM("V",26)="IOT=""TRM""" ^SAM("V",27)="IOUPAR=""""" ^SAM("V",28)="IOXY=""""" ^SAM("V",29)="POP=0" ^SAM("V",30)="TYPE=1" ^SAM("V",31)="U=""^""" ^SAM("V",32)="X=""^XUTL(""""XUSYS"""",23771,1)""" ^SAM("V",33)="XPARSYS=""21;DIC(4.2,""" ^SAM("V",34)="XQMES=1" ^SAM("V",35)="XQY0=""XUS SIGNON""" ^SAM("V",36)="XR=""[XWB]""" ^SAM("V",37)="XWB(0,""LENV"")=3" ^SAM("V",38)="XWB(0,""RT"")=0" ^SAM("V",39)="XWB(0,""TYPE"")=1" ^SAM("V",40)="XWB(0,""VER"")=1" ^SAM("V",41)="XWB(2,""RNAM"")=""XUSRB""" ^SAM("V",42)="XWB(2,""RPC"")=""XUS SIGNON SETUP""" ^SAM("V",43)="XWB(2,""RTAG"")=""SETUP""" ^SAM("V",44)="XWB(2,""VER"")=1.108" ^SAM("V",45)="XWB(5,""XWB"",0)=""""" ^SAM("V",46)="XWB(""PARAM"")=""""" ^SAM("V",47)="XWBAPVER=1.108" ^SAM("V",48)="XWBCALL=""SETUP^XUSRB(.XWBY)""" ^SAM("V",49)="XWBCALL2=""""" ^SAM("V",50)="XWBCLMAN=""RPCTEST""" ^SAM("V",51)="XWBDEBUG=0" ^SAM("V",52)="XWBENVL=3" ^SAM("V",53)="XWBERROR=""""" ^SAM("V",54)="XWBNULL=""/dev/null""" ^SAM("V",55)="XWBOS=""GT.M""" ^SAM("V",56)="XWBPRT=0" ^SAM("V",57)="XWBPTYPE=2" ^SAM("V",58)="*XWBR=XWBP" ^SAM("V",59)="XWBRBUF=""""" ^SAM("V",60)="XWBSEC=""""" ^SAM("V",61)="XWBT(""BF"")=""#""" ^SAM("V",62)="XWBT(""PCNT"")=1" ^SAM("V",63)="XWBTBUF=""""" ^SAM("V",64)="XWBTCMD=""""" ^SAM("V",65)="XWBTDEV=0" ^SAM("V",66)="XWBTIME=90" ^SAM("V",67)="XWBTIME(1)=2" ^SAM("V",68)="XWBTIP=""172.16.19.73""" ^SAM("V",69)="XWBTSKT=0" ^SAM("V",70)="XWBVER=1.108" ^SAM("V",71)="XWBWRAP=0" ^SAM("V",72)="*XWBY=XWBP"

CMD> %GTM-I-CTRLC, CTRL_C encountered

sw-dev> ZG

sw-dev> ; $GET

sw-dev> WRITE SAM %GTM-E-UNDEF, Undefined local variable: SAM

sw-dev> WRITE $GET(SAM)

sw-dev> ; $Get protects you from undefined errors.

sw-dev> ; If a variable or global is undefined, you get an empty string instead

sw-dev> WRITE ^SAM(1,3,4,8) %GTM-E-GVUNDEF, Global variable undefined: ^SAM(1,3,4,8)

sw-dev> WRITE $G(^SAM(1,3,4,8))

sw-dev> WRITE $G(^SAM(1,3,4,8))="" 1 sw-dev> WRITE $G(SAM,"not defined") not defined sw-dev> zed "KBANGET"

sw-dev> zl

sw-dev> zp ^KBANGET KBANGET ; 3/15/11 10:45am

EN(A,B,C,D,E) SET A=$G(A,0) ; Set a default value of zero for A if not defined SET B=$G(B,"NONE") SET C=$G(C,1) SET D=$G(D,0) SET E=$G(E,0) QUIT A+B+C+D+E

sw-dev> D EN^KBANGET(1,2,3,4,5) %GTM-E-STACKCRIT, Stack space critical %GTM-E-ERRWZTRAP, Error while processing $ZTRAP

sw-dev> ZED

sw-dev> zl

sw-dev> D EN^KBANGET(1,2,3,4,5) %GTM-E-NOTEXTRINSIC, Quit does not return to an extrinsic function: argument not allowed

sw-dev> zg

sw-dev> W $$EN^KBANGET(1,2,3,4,5) 15 sw-dev> W $$EN^KBANGET(1,2,3,4) 10 sw-dev> W $$EN^KBANGET(1,,3,4) 8 sw-dev> ZED

sw-dev> W $$EN^KBANGET(1,,,4) 6 sw-dev> ; $GET common scenarios for use

sw-dev> Output variables for functions that don't always exist. %GTM-E-INVCMD, Invalid command keyword encountered Output variables for functions that don't always exist. ^-

sw-dev> ; Output variables for functions that don't always exist.

sw-dev> ; DIERR

sw-dev> ; if you do this when there is no error 'I DIERR', you crash

sw-dev> ; do this... I $G(DIERR)

sw-dev> ; ^DIR, ^DIC output DTOUT or DUOUT ; same issue

sw-dev> ; $Get also is used to set default values for parameters that are passed into a procedure/function

sw-dev> ; $Get is also used in for loops when the exit variable doesn't exist ye t.

sw-dev> zed

sw-dev> zl

sw-dev> zp FOR^KBANGET:FOR+10 FOR NEW DONE FOR I=1:1:10 QUIT:DONE=1 DO . IF I>5 SET DONE=1 QUIT

sw-dev> D FOR^KBANGET %GTM-E-UNDEF, Undefined local variable: DONE

sw-dev> ZED

sw-dev> zl

sw-dev> rec zp

sw-dev> zp FOR^KBANGET:FOR+10 FOR NEW DONE FOR I=1:1:10 QUIT:$G(DONE)=1 DO . IF I>5 SET DONE=1 QUIT

sw-dev> rec D

sw-dev> D FOR^KBANGET

sw-dev> ; $TEXT - prints line of a routine

sw-dev> W $TEXT(FOR^KBANGET) FOR sw-dev> W $TEXT(FOR+1^KBANGET) NEW DONE sw-dev> W $TEXT(FOR+2^KBANGET) FOR I=1:1:10 QUIT:$G(DONE)=1 DO sw-dev> W $TEXT(FOR+3^KBANGET) . IF I>5 SET DONE=1 sw-dev> W $TEXT(0)

sw-dev> ; $TEXT behaves differently in a routine.

sw-dev> zed

sw-dev> zp TEXT^KBANGET:TEXT+5 %GTM-E-ZPRTLABNOTFND, Label not found in routine

sw-dev> ZL

sw-dev> zp TEXT^KBANGET:TEXT+5 TEXT WRITE $TEXT(+0) QUIT

sw-dev> DO TEXT^KBANGET KBANGET sw-dev> ZED

sw-dev> zl

sw-dev> zp TEXT^KBANGET:TEXT+5 TEXT WRITE $TEXT(+0) WRITE $TEXT(+1) QUIT

sw-dev> DO TEXT^KBANGET KBANGETKBANGET ; 3/15/11 10:55am sw-dev> zed

sw-dev> zl

sw-dev> DO TEXT^KBANGET KBANGET KBANGET ; 3/15/11 10:55am

sw-dev> zed

sw-dev> zl

sw-dev> rec zp

sw-dev> zp TEXT^KBANGET:TEXT+5 TEXT WRITE $TEXT(+0),! ; Name of the routine WRITE $TEXT(+1),! ; First line of the routine QUIT

sw-dev> zp ^DI DI ;SFISC/GFT-DIRECT ENTRY TO VA FILEMAN ;7/25/94 3:07 PM V ;;22.0;VA FileMan;;Mar 30, 1999 ;Per VHA Directive 10-93-142, this routine should not be modified. G QQ:$G(^DI(.84,0))']"" C G QQ:$G(^DI(.84,0))']"" K (DTIME,DUZ) G ^DII D G QQ:$G(^DI(.84,0))']"" G ^DII P G QQ:$G(^DI(.84,0))']"" K (DTIME,DUZ) Q G QQ:$G(^DI(.84,0))']"" S DUZ(0)="@" G ^DII VERSION ; S VERSION=$P($T(V),";",3),X="VA FileMan V."_VERSION Q ; QQ ; W $C(7),!!,"You must run ^DINIT first." Q

sw-dev> D P^DI

VA FileMan 22.0

Select OPTION: sw-dev>