Mumps Class 7

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 Jan 24 05:00:47 2011 from 192.168.56.1
worldvistaEHR@cassandra:~$ zed
-bash: zed: command not found
worldvistaEHR@cassandra:~$ gtm

GTM>h
worldvistaEHR@cassandra:~$ GTM

GTM>ZED "KBANIF"

GTM>zp ^KBANIF
KBANIF ; Routine to show the use of If and Do commands ; 1/24/11 12:26pm
 ;
 READ "Enter X: ",X,!
 IF X WRITE "X IS TRUE",!

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

GTM>d ^KBANIF
Enter X: 4
X IS TRUE

GTM>d ^KBANIF
Enter X: 0

GTM>zl

GTM>zed

GTM>zlink

GTM>d ^KBANIF
Enter X: 3
$TEST value is: 1

GTM>zp ^KBANIF
KBANIF ; Routine to show the use of If and Do commands ; 1/24/11 12:28pm
 ;
 READ "Enter X: ",X,!
 IF X
 WRITE "$TEST value is: ",$TEST,!

GTM>d ^KBANIF
Enter X: 3
$TEST value is: 1

GTM>d ^KBANIF
Enter X: 0
$TEST value is: 0

GTM>zed

GTM>zl

GTM>zp ^KBANIF
KBANIF ; Routine to show the use of If and Do commands ; 1/24/11 12:30pm
 ;
 READ "Enter X: ",X,!
 IF X WRITE "X IS TRUE",!
 ELSE  WRITE "X IS FALSE",!
 WRITE "$TEST value is: ",$TEST,!

GTM>d ^KBANIF
Enter X: 5
X IS TRUE
$TEST value is: 1

GTM>d ^KBANIF
Enter X: 0
X IS FALSE
$TEST value is: 0

GTM>; What is $TEST?

GTM>; $TEST is the INSTRINSIC VARIABLE in Mumps that is set by the if command

GTM>; Else is only executed if $TEST is zero.

GTM>; A true if sets $TEST to 1.

GTM>R X:5 ELSE  WRITE "NOTHING TO READ"
NOTHING TO READ
GTM>R X:5 ELSE  WRITE "NOTHING TO READ"
3
GTM>; Besides the if command, any Mumps command with a timeout (Read, Open     k

GTM>; and Lock, sets $Test as well.

GTM>zed

GTM>zlink

GTM>zp ^KBANIF
KBANIF ; Routine to show the use of If and Do commands ; 1/24/11 12:37pm
 ;
 READ "Enter X: ",X,!
 IF X WRITE "X IS TRUE",!
 ELSE  WRITE "X IS FALSE",!
 WRITE "$TEST value is: ",$TEST,!
 ;
 ; Read command with a timeout of 5 seconds
 READ !,"Enter X, or wait 5 seconds: ",X,!
 WRITE "X is ",X,!
 WRITE "$TEST value is ",$TEST,!

GTM>d ^KBANIF
Enter X: 0
X IS FALSE
$TEST value is: 0

Enter X, or wait 5 seconds: 2
X is 2
$TEST value is 0

GTM>d ^KBANIF
Enter X: 0
X IS FALSE
$TEST value is: 0

Enter X, or wait 5 seconds:
X is
$TEST value is 0

GTM>; oooops forgot timeout on read

GTM>zed

GTM>zl

GTM>d ^KBANIF
Enter X:
%GTM-I-CTRLC, CTRL_C encountered

GTM>zg

GTM>zp ^KBANIF
KBANIF ; Routine to show the use of If and Do commands ; 1/24/11 12:39pm
 ;
 READ "Enter X: ",X,!
 IF X WRITE "X IS TRUE",!
 ELSE  WRITE "X IS FALSE",!
 WRITE "$TEST value is: ",$TEST,!
 ;
 ; Read command with a timeout of 5 seconds
 READ !,"Enter X, or wait 5 seconds: ",X:5,!
 WRITE "X is ",X,!
 WRITE "$TEST value is ",$TEST,!

GTM>D ^KBANIF
Enter X: 3
X IS TRUE
$TEST value is: 1

Enter X, or wait 5 seconds: 2
X is 2
$TEST value is 1

GTM>D ^KBANIF
Enter X: 3
X IS TRUE
$TEST value is: 1

Enter X, or wait 5 seconds:
X is
$TEST value is 0

GTM>; Read with timeout:

GTM>; if read is successful, then $TEST is 1

GTM>; if read is not successful, then $TEST is zero

GTM>READ X:5 IF '$TEST WRITE "No input",!
No input

GTM>zed

GTM>zl

GTM>zp

GTM>zp ^KBANIF
KBANIF ; Routine to show the use of If and Do commands ; 1/24/11 12:45pm
 ;
 READ "Enter X: ",X,!
 IF X WRITE "X IS TRUE",!
 ELSE  WRITE "X IS FALSE",!
 WRITE "$TEST value is: ",$TEST,!
 ;
 ; Read command with a timeout of 5 seconds
 READ !,"Enter X, or wait 5 seconds: ",X:5,!
 WRITE "X is ",X,!
 WRITE "$TEST value is ",$TEST,!
 ;
T3
 ; If command, secret form
 READ "Enter X: ",X,!
 IF X
 WRITE "$TEST value is: ",$TEST,!
 IF  WRITE "If, secret form, activated",!
 ELSE  WRITE "Else activated",!

GTM>DO T3^KBANIF
Enter X: 1
$TEST value is: 1
If, secret form, activated

GTM>DO T3^KBANIF
Enter X: 0
$TEST value is: 0
Else activated

GTM>; If with no arguments, executes only if $TEST is true

GTM>; Else with no arguments, executes only if $TEST if false

GTM>; $TEST is set with If command or any command that has a timeout

GTM>; A value of 1 means success; 0 zero means failure.

GTM>halt
worldvistaEHR@cassandra:~$ gtm

GTM>WRITE $TEST
1
GTM>I  WRITE "HELLO"
HELLO
GTM>E  WRITE "HELLO"

GTM>ZED "KBANIF"

GTM>SET $TEST=0
%GTM-E-SVNOSET, Cannot SET this special variable

GTM>; To change $TEST to zero, write IF 0

GTM>WRITE $TEST
1
GTM>IF 0

GTM>WRITE $TEST
0
GTM>ZED

GTM>zl

GTM>zp ^KBANIF
KBANIF ; Routine to show the use of If and Do commands ; 1/24/11 12:53pm
 ;
 READ "Enter X: ",X,!
 IF X WRITE "X IS TRUE",!
 ELSE  WRITE "X IS FALSE",!
 WRITE "$TEST value is: ",$TEST,!
 ;
 ; Read command with a timeout of 5 seconds
 READ !,"Enter X, or wait 5 seconds: ",X:5,!
 WRITE "X is ",X,!
 WRITE "$TEST value is ",$TEST,!
 ;
T3
 ; If command, secret form
 READ "Enter X: ",X,!
 IF X
 WRITE "$TEST value is: ",$TEST,!
 IF  WRITE "If, secret form, activated",!
 ELSE  WRITE "Else activated",!
 ;
 ; Do command examples
VISTA
 DO ^ZU

GTM>D VISTA^KBANIF
                          WorldVistA EHR /VOE 1.0


                   Access is monitored and restricted.
                No unauthorized access will be permitted.

IMPORTANT FOR ALL PROVIDERS:

All drugs that the provider may need must be entered into the database
BEFORE THE PROVIDER PRESCIBES THEM from WorldVistA EHR.THE DRUG FILE
INCLUDED HAS NOT BEEN PREVIOUSLY RELEASED. IT IS ALWAYS IMPERATIVE THAT
ANY AND ALL DRUG ORDERS AND PRESCRIPTIONS BE CAREFULLY REVIEWED BY THE
PRESCRIBING PHYSICIAN AND DISPENSING PHARMACIST TO INSURE ACCURACY.   IF
PROBLEMS ARE FOUND, PLEASE REPORT THEM HERE

        INFO@WORLDVISTA.ORG
                OR
        http://trac.opensourcevista.net/worldvistaehr

Please see this link for information about entering new drugs and drug
doseages:

<http://worldvista.org/World_VistA_EHR/license-and-readme/ReadMe%20-%20Wor
ldVistA%20Pharmacy%20Drug%20File%202008-01-31.pdf>

Please look for additional information and updates about this release
here:

 <http://worldvista.org/World_VistA_EHR/license-and-readme>

All portions of this release that are modified from the original Freedom
of Informtion Act release provided by the Department of Veterans Affairs
carry the GPL license and are Copyright WorldVistA.  See this URL for the
full text of the license:

http://worldvista.org/World_VistA_EHR/license-and-readme/WorldVistA%20EHR%
20GPL%20License.txt

YOU SHOULD CAREFULLY READ THE FOLLOWING TERMS AND CONDITIONS BEFORE USING
THIS PRODUCT.  DOWNLOADING OR USING ANY PART OF THE SOFTWARE AND
DOCUMENTATION INDICATES THAT YOU ACCEPT THESE TERMS AND CONDITIONS.  IF
YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT, DO NOT
PROCEED.

 A.  General Disclaimer.  THE WORLDVISTA-EHR (WV-EHR) SOFTWARE IS
PROVIDED TO RECIPIENT HEREUNDER "AS IS" AND ANY USE OF WV-EHR SOFTWARE BY
REQUESTOR SHALL BE AT ITS OWN RISK.  TO THE MAXIMUM EXTENT PERMITTED BY
APPLICABLE LAW, WORLDVISTA AND ITS CONTRACTORS, EMPLOYEES AND AGENTS
DISCLAIM ALL WARRANTIES WITH RESPECT TO WV-EHR SOFTWARE, EXPRESS, IMPLIED
AND STATUTORY, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, ACCURACY,
COMPLETENESS, TIMELINESS, NON INFRINGEMENT OF THIRD-PARTY RIGHTS, NON
INTERFERENCE, AND ERROR FREE SERVICE. WORLDVISTA TAKES NO RESPONSIBILITY
FOR MONITORING OR REGULATING THE USE OR ACCURACY OF WV-EHR SOFTWARE.
RECIPIENT ACKNOWLEDGES AND AGREES THAT WORLDVISTA IS UNDER NO OBLIGATION
TO VERIFY THE ACCURACY OF OR OTHERWISE UPDATE WV-EHR SOFTWARE OR ANY
CONTENT CONTAINED THEREIN OR TO NOTIFY RECIPIENT OF ANY INACCURACIES
THEREIN OR UPDATES THERETO THAT MAY COME TO THE ATTENTION OF OR BE
DEVELOPED BY WORLDVISTA. WV-EHR MAY BE UPDATED PERIODICALLY, AND IT IS
THE RESPONSIBILITY OF THE RECIPIENT TO OBTAIN UPDATED VERSIONS OF THE
WV-EHR RELEASE AS REQUIRED. WORLDVISTA BEARS NO RESPONSIBILITY FOR
PROVIDING UPDATES TO RECIPIENTS.

 B.  LIMITATION OF LIABILITY.  TO THE MAXIMUM EXTENT PERMITTED BY
APPLICABLE LAW, NEITHER WORLDVISTA NOR ANY OF ITS EMPLOYEES, AGENTS OR
CONTRACTORS SHALL BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
CONSEQUENTIAL OR PUNITIVE DAMAGES, INCLUDING WITHOUT LIMITATION DAMAGES
FOR LOST PROFITS OR REVENUES, GOODWILL, WORK STOPPAGE, SECURITY BREACHES,
FOR LOST PROFITS OR REVENUES, GOODWILL, WORK STOPPAGE, SECURITY BREACHES,
VIRUSES, COMPUTER FAILURE OR MALFUNCTION, USE, DATA OR OTHER INTANGIBLE
LOSSES OR COMMERCIAL DAMAGES, EVEN IF ANY OF SUCH PARTIES IS ADVISED OF
THE POSSIBILITY OF SUCH LOSSES, ARISING UNDER OR IN CONNECTION WITH THIS
AGREEMENT, COMPLIANCE EFFECTIVENESS STUDY TOOLS, THE USE OF OR INABILITY
TO USE THE SAME, OR ANY OTHER SUBJECT MATTER HEREOF. IN ADDITION, TO THE
MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, NEITHER WORLDVISTA NOR ANY OF
ITS EMPLOYEES, AGENTS OR CONTRACTORS SHALL BE LIABLE FOR ANY LOSS OR
DAMAGE SUFFERED BY RECIPIENT WHICH ARISES OUT OF OR IN CONNECTION WITH
ANY INFORMATION OBTAINED BY RECIPIENT VIA OR IN CONNECTION WITH WV-EHR
SOFTWARE.



Volume set: EHR:cassandra  UCI: EHR  Device: /dev/pts/0

ACCESS CODE:
























Logged out at Jan 24, 2011 12:53 pmworldvistaEHR@cassandra:~$ GTM

GTM>zl
%GTM-E-ZLINKFILE, Error while zlinking ""

GTM>zed "KBANIF"

GTM>zl

GTM>zp ^KBANIF
KBANIF ; Routine to show the use of If and Do commands ; 1/24/11 12:55pm
 ;
 READ "Enter X: ",X,!
 IF X WRITE "X IS TRUE",!
 ELSE  WRITE "X IS FALSE",!
 WRITE "$TEST value is: ",$TEST,!
 ;
 ; Read command with a timeout of 5 seconds
 READ !,"Enter X, or wait 5 seconds: ",X:5,!
 WRITE "X is ",X,!
 WRITE "$TEST value is ",$TEST,!
 ;
T3
 ; If command, secret form
 READ "Enter X: ",X,!
 IF X
 WRITE "$TEST value is: ",$TEST,!
 IF  WRITE "If, secret form, activated",!
 ELSE  WRITE "Else activated",!
 ;
 ; Do command examples
VISTA
 DO ^ZU
 QUIT
 ; Conditionally execute something
DO1
 WRITE "DO1 was called"
 QUIT
DO2
 WRITE "DO2 was called"
 QUIT
T4
 READ "Enter X: ",X,!
 IF X DO DO1
 ELSE  DO DO2

GTM>d T4^KBANIF
Enter X: 1
DO1 was called
GTM>d T4^KBANIF
Enter X: 0
DO2 was called
GTM>ZED

GTM>zed "ZU"

GTM>ZED

GTM>zed "KBANIF"

GTM>zl

GTM>zp ^KBANIF
KBANIF ; Routine to show the use of If and Do commands ; 1/24/11 1:00pm
 ;
 READ "Enter X: ",X,!
 IF X WRITE "X IS TRUE",!
 ELSE  WRITE "X IS FALSE",!
 WRITE "$TEST value is: ",$TEST,!
 ;
 ; Read command with a timeout of 5 seconds
 READ !,"Enter X, or wait 5 seconds: ",X:5,!
 WRITE "X is ",X,!
 WRITE "$TEST value is ",$TEST,!
 QUIT
 ;
T3
 ; If command, secret form
 READ "Enter X: ",X,!
 IF X
 WRITE "$TEST value is: ",$TEST,!
 IF  WRITE "If, secret form, activated",!
 ELSE  WRITE "Else activated",!
 QUIT
 ;
 ; Do command examples
VISTA
 DO EN^ZU
 QUIT
 ; Conditionally execute something
DO1
 WRITE "DO1 was called"
 QUIT
DO2
 WRITE "DO2 was called"
 QUIT
T4
 READ "Enter X: ",X,!
 IF X DO DO1  ; If ^ is not specified, Do assumes that label is in the same routine
 ELSE  DO DO2

GTM>; Do with an ^ on the argument calls the routine after the ^ name from the top

GTM>; E.g. DO ^ZU

GTM>; Do inside a routine with no ^ looks for a label with that name

GTM>; E.g. DO T4

GTM>; To call a specific label in a routine if it is not your own routine, put the

GTM>; label before the ^

GTM>; E.g. DO EN^ZU

GTM>; E.g. DO Q^DI

GTM>zp ^DI
DI ;SFISC/GFT-DIRECT ENTRY TO VA FILEMAN ;18JUN2010
V ;;22.1039;MSC FileMan;;Mar 30, 1999
 ;
 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=$P($T(V),";",4)_" "_VERSION Q
 ;
QQ ;
 W $C(7),!!,"You must run ^DINIT first."
 Q

GTM>; The difference between calling P and Q ^DI

GTM>zp ^DI
DI ;SFISC/GFT-DIRECT ENTRY TO VA FILEMAN ;18JUN2010
V ;;22.1039;MSC FileMan;;Mar 30, 1999
 ;
 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=$P($T(V),";",4)_" "_VERSION Q
 ;
QQ ;
 W $C(7),!!,"You must run ^DINIT first."
 Q

GTM>zed "KBANIF"

GTM>zl

GTM>zp ^KBANIF
KBANIF ; Routine to show the use of If and Do commands ; 1/24/11 1:19pm
 ;
 READ "Enter X: ",X,!
 IF X WRITE "X IS TRUE",!
 ELSE  WRITE "X IS FALSE",!
 WRITE "$TEST value is: ",$TEST,!
 ;
 ; Read command with a timeout of 5 seconds
 READ !,"Enter X, or wait 5 seconds: ",X:5,!
 WRITE "X is ",X,!
 WRITE "$TEST value is ",$TEST,!
 QUIT
 ;
T3
 ; If command, secret form
 READ "Enter X: ",X,!
 IF X
 WRITE "$TEST value is: ",$TEST,!
 IF  WRITE "If, secret form, activated",!
 ELSE  WRITE "Else activated",!
 QUIT
 ;
 ; Do command examples
VISTA
 DO EN^ZU
 QUIT
 ; Conditionally execute something
DO1
 WRITE "DO1 was called"
 QUIT
DO2
 WRITE "DO2 was called"
 QUIT
T4 ; Doing a label in a routine
 READ "Enter X: ",X,!
 IF X DO DO1  ; If ^ is not specified, Do assumes that label is in the same routine
 ELSE  DO DO2
 QUIT
T5 ; Anonymous Do blocks.
 READ "Enter X: ",X,!
 ; Do here does not call a label or routine; it calls the lines below it.
 ; Anonymous Dos must have two spaces after the DO.
 IF X DO  WRITE "Now outside the Do block, but still in the if statement",!
 . WRITE "I am inside the Do block",!
 . WRITE "Still inside the Do block",!
 WRITE "Now After the If Statement",!

GTM>DO T5^KBANIF
Enter X: 1
I am inside the Do block
Still inside the Do block
Now outside the Do block, but still in the if statement
Now After the If Statement

GTM>zed "KBANIF"

GTM>zl

GTM>zp ^KBANIF
KBANIF ; Routine to show the use of If and Do commands ; 1/24/11 1:22pm
 ;
 READ "Enter X: ",X,!
 IF X WRITE "X IS TRUE",!
 ELSE  WRITE "X IS FALSE",!
 WRITE "$TEST value is: ",$TEST,!
 ;
 ; Read command with a timeout of 5 seconds
 READ !,"Enter X, or wait 5 seconds: ",X:5,!
 WRITE "X is ",X,!
 WRITE "$TEST value is ",$TEST,!
 QUIT
 ;
T3
 ; If command, secret form
 READ "Enter X: ",X,!
 IF X
 WRITE "$TEST value is: ",$TEST,!
 IF  WRITE "If, secret form, activated",!
 ELSE  WRITE "Else activated",!
 QUIT
 ;
 ; Do command examples
VISTA
 DO EN^ZU
 QUIT
 ; Conditionally execute something
DO1
 WRITE "DO1 was called"
 QUIT
DO2
 WRITE "DO2 was called"
 QUIT
T4 ; Doing a label in a routine
 READ "Enter X: ",X,!
 IF X DO DO1  ; If ^ is not specified, Do assumes that label is in the same routine
 ELSE  DO DO2
 QUIT
T5 ; Anonymous Do blocks.
 READ "Enter X: ",X,!
 ; Do here does not call a label or routine; it calls the lines below it.
 ; Anonymous Dos must have two spaces after the DO.
 IF X DO  WRITE "Now outside the Do block, but still in the if statement",!
 . WRITE "I am inside the Do block",!
 WRITE "I am outside of the Do block",!
 . WRITE "Still inside the Do block",!
 WRITE "Now After the If Statement",!

GTM>D T5^KBANIF
Enter X: 1
I am inside the Do block
Now outside the Do block, but still in the if statement
I am outside of the Do block
Now After the If Statement

GTM>ZED

GTM>zed

GTM>zl

GTM>zp ^KBANIF
KBANIF ; Routine to show the use of If and Do commands ; 1/24/11 1:28pm
 ;
 READ "Enter X: ",X,!
 IF X WRITE "X IS TRUE",!
 ELSE  WRITE "X IS FALSE",!
 WRITE "$TEST value is: ",$TEST,!
 ;
 ; Read command with a timeout of 5 seconds
 READ !,"Enter X, or wait 5 seconds: ",X:5,!
 WRITE "X is ",X,!
 WRITE "$TEST value is ",$TEST,!
 QUIT
 ;
T3
 ; If command, secret form
 READ "Enter X: ",X,!
 IF X
 WRITE "$TEST value is: ",$TEST,!
 IF  WRITE "If, secret form, activated",!
 ELSE  WRITE "Else activated",!
 QUIT
 ;
 ; Do command examples
VISTA
 DO EN^ZU
 QUIT
 ; Conditionally execute something
DO1
 WRITE "DO1 was called"
 QUIT
DO2
 WRITE "DO2 was called"
 QUIT
T4 ; Doing a label in a routine
 READ "Enter X: ",X,!
 IF X DO DO1  ; If ^ is not specified, Do assumes that label is in the same routine
 ELSE  DO DO2
 QUIT
T5 ; Anonymous Do blocks.
 READ "Enter X: ",X,!
 ; Do here does not call a label or routine; it calls the lines below it.
 ; Anonymous Dos must have two spaces after the DO.
 IF X DO  WRITE "Now outside the Do block, but still in the if statement",!
 . WRITE "I am inside the Do block",!
 . WRITE "Still inside the Do block",!
 WRITE "Now After the If Statement",!
 QUIT
 ;
T6 ; Anonymous Do, second example
 FOR I=1:1:10 DO
 . WRITE "I: ",I
 . WRITE ?20,"Another statement"
 QUIT

GTM>D T6^KBANIF
I: 1                Another statementI: 2Another statementI: 3Another statementI: 4Another statement
I: 5                Another statementI: 6Another statementI: 7Another statementI: 8Another statement
I: 9                Another statementI: 10Another statement
GTM>ZED

GTM>zl

GTM>zp T6^KBANIF:T6+10
%GTM-E-SPOREOL, Either a space or an end-of-line was expected but not found
        zp T6^KBANIF:T6+10
             ^-----

GTM>zp T6^KBANIF
%GTM-E-SPOREOL, Either a space or an end-of-line was expected but not found
        zp T6^KBANIF
             ^-----

GTM>zP ^KBANIF
%GTM-E-INVCMD, Invalid command keyword encountered
        zpP ^KBANIF
        ^-----

GTM>zp ^KBANIF
KBANIF ; Routine to show the use of If and Do commands ; 1/24/11 1:28pm
 ;
 READ "Enter X: ",X,!
 IF X WRITE "X IS TRUE",!
 ELSE  WRITE "X IS FALSE",!
 WRITE "$TEST value is: ",$TEST,!
 ;
 ; Read command with a timeout of 5 seconds
 READ !,"Enter X, or wait 5 seconds: ",X:5,!
 WRITE "X is ",X,!
 WRITE "$TEST value is ",$TEST,!
 QUIT
 ;
T3
 ; If command, secret form
 READ "Enter X: ",X,!
 IF X
 WRITE "$TEST value is: ",$TEST,!
 IF  WRITE "If, secret form, activated",!
 ELSE  WRITE "Else activated",!
 QUIT
 ;
 ; Do command examples
VISTA
 DO EN^ZU
 QUIT
 ; Conditionally execute something
DO1
 WRITE "DO1 was called"
 QUIT
DO2
 WRITE "DO2 was called"
 QUIT
T4 ; Doing a label in a routine
 READ "Enter X: ",X,!
 IF X DO DO1  ; If ^ is not specified, Do assumes that label is in the same routine
 ELSE  DO DO2
 QUIT
T5 ; Anonymous Do blocks.
 READ "Enter X: ",X,!
 ; Do here does not call a label or routine; it calls the lines below it.
 ; Anonymous Dos must have two spaces after the DO.
 IF X DO  WRITE "Now outside the Do block, but still in the if statement",!
 . WRITE "I am inside the Do block",!
 . WRITE "Still inside the Do block",!
 WRITE "Now After the If Statement",!
 QUIT
 ;
T6 ; Anonymous Do, second example
 FOR I=1:1:10 DO
 . WRITE "I: ",I
 . WRITE ?20,"Another statement",!
 QUIT

GTM>D T6^KBANIF
I: 1                Another statement
I: 2                Another statement
I: 3                Another statement
I: 4                Another statement
I: 5                Another statement
I: 6                Another statement
I: 7                Another statement
I: 8                Another statement
I: 9                Another statement
I: 10               Another statement

GTM>ZED

GTM>ZL

GTM>ZP ^KBANIF
KBANIF ; Routine to show the use of If and Do commands ; 1/24/11 1:32pm
 ;
 READ "Enter X: ",X,!
 IF X WRITE "X IS TRUE",!
 ELSE  WRITE "X IS FALSE",!
 WRITE "$TEST value is: ",$TEST,!
 ;
 ; Read command with a timeout of 5 seconds
 READ !,"Enter X, or wait 5 seconds: ",X:5,!
 WRITE "X is ",X,!
 WRITE "$TEST value is ",$TEST,!
 QUIT
 ;
T3
 ; If command, secret form
 READ "Enter X: ",X,!
 IF X
 WRITE "$TEST value is: ",$TEST,!
 IF  WRITE "If, secret form, activated",!
 ELSE  WRITE "Else activated",!
 QUIT
 ;
 ; Do command examples
VISTA
 DO EN^ZU
 QUIT
 ; Conditionally execute something
DO1
 WRITE "DO1 was called"
 QUIT
DO2
 WRITE "DO2 was called"
 QUIT
T4 ; Doing a label in a routine
 READ "Enter X: ",X,!
 IF X DO DO1  ; If ^ is not specified, Do assumes that label is in the same routine
 ELSE  DO DO2
 QUIT
T5 ; Anonymous Do blocks.
 READ "Enter X: ",X,!
 ; Do here does not call a label or routine; it calls the lines below it.
 ; Anonymous Dos must have two spaces after the DO.
 IF X DO  WRITE "Now outside the Do block, but still in the if statement",!
 . WRITE "I am inside the Do block",!
 . WRITE "Still inside the Do block",!
 WRITE "Now After the If Statement",!
 QUIT
 ;
T6 ; Anonymous Do, second example
 FOR I=1:1:10 DO
 . WRITE "I: ",I
 . WRITE ?20,"Another statement",!
 QUIT
 ;
T7 ; Anonymous Do, third example
 DO  IF X WRITE "X is true, and I am quitting" QUIT
 . R "Enter X: ",X,!
 . W "X is: ",X,!
 WRITE "I am after the Do block",!
 QUIT

GTM>DO T7^KBANIF
Enter X: 1
X is: 1
X is true, and I am quitting
GTM>DO T7^KBANIF
Enter X: 0
X is: 0
I am after the Do block