source: FOIAVistA/trunk/r/KERNEL-XU-A4A7-USC-XG-XLF-XNOA-XPD-XQ-XVIR-ZI-ZOSF-ZOSV-ZT-ZU-%Z-XIP--XQAB--XUC--XUR--ZIN--ZTED/ZIS1.m@ 785

Last change on this file since 785 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 5.1 KB
Line 
1%ZIS1 ;SFISC/AC,RWF -- DEVICE HANDLER (DEVICE INPUT) ;1/24/08 16:06
2 ;;8.0;KERNEL;**18,49,69,104,112,199,391,440**;JUL 10, 1995;Build 13
3 ;Per VHA Directive 2004-038, this routine should not be modified
4MAIN ;Called from %ZIS with a GO
5 I '$D(IOP),$D(^%ZIS(1,%E,0)),'$P(^(0),"^",3) S %A=%H,%Z=^(0) D L2^%ZIS2 G EXIT
6L1 ;Main Loop
7 I '$D(IOP),$D(IO("Q")),POP D AQUE^%ZIS3 K:%=2 IO("Q") S:%=2 %ZISB=$S(%IS'["N":2,1:0) I %=-1 S POP=1 G EXIT
8 S %E=%H,POP=0,%IS=%ZIS ;Reset %IS from %ZIS
9 I %IS'["Q",$D(XQNOGO) S POP=1 W:'$D(IOP) !,$C(7),"OUTPUT IS NEVER ALLOWED FOR THIS OPTION" G EXIT
10 D IOP:$D(IOP),R:'$D(IOP)
11 G EXIT:$D(DTOUT)!$D(DUOUT)!(POP&$D(IOP)),L1:POP&'$D(IOP)
12 D LKUP I %A'>0 S POP=1 D:'$D(DUOUT) MSG1 K DUOUT
13 I '$D(^%ZIS(1,%A,0)) D MSG1 K %ZISIOS S POP=1
14 I POP G EXIT:$D(IOP),L1:'$D(IOP)
15 S %E=%A,%Z=^%ZIS(1,%A,0),%Z1=$G(^(1))
16 I $D(%ZIS("S")) N Y S Y=%E D XS^ZISX S:'$T POP=1 G G:POP
17 W:'$D(IOP)&($P(%Z,"^",2)'=$I)&($P(%Z1,"^")]"") " ",$P(%Z1,"^")
18 D L2^%ZIS2 ;Call
19G G L1:POP&'$D(IOP)&'($D(DTOUT)!$D(DUOUT)) ;Didn't get it
20 ;
21EXIT ;
22 I POP G EX2 ;Did not get the device.
23 ;For type[TRM reset $X & $Y
24 I %ZTYPE["TRM",IO]"",$D(IO(1,IO)) U IO S:'(IO=IO(0)&'$D(IO("S"))&'$D(ZTQUEUED)) $X=0,$Y=0
25 ;Do count of number of times device opened. Field 51.
26 I $L($G(IO)),$D(IO(1,IO))#2,$G(%ZISIOS) D
27 . S $P(^(5),"^",1)=$P($G(^%ZIS(1,%ZISIOS,5)),"^",1)+1
28 I %ZIS["H" S IO(0)=IO,IO("HOME")=%ZISIOS_"^"_IO ;Make home device
29 I '$D(IO("Q")),$D(%ZISLOCK) S ^XUTL("XQ",$J,"lock",%ZISIOS)=%ZISLOCK
30 I $D(IO)#2,IO]"",$D(IO(1,IO))#2,$D(%Z1),$P(%Z1,"^",11) S IO(1,IO,"NOFF")=1
31EX2 ;
32 I %IS'[0,$G(IO(0))]"" U IO(0) ;Make sure return with home active
33 G SETVAR:'POP!(%IS["T"),KILVAR
34 ;
35IOP ;Request with IOP set
36 S (%ZISVT,%X)=IOP S:%X'?1.UNP %X=$$UP(%X) I %X'="Q" D SETQ Q
37 S %IS=%IS_%X K IOP W %X D SETQ Q
38 ;Get ready to ask user for device
39R I %IS["Q",$D(XQNOGO) W !,$C(7),"AT THIS TIME, OUTPUT MUST BE QUEUED"
40 S %A=$S($D(%IS("B")):%IS("B"),1:"HOME") ;Setup default
41 I %IS["P",%A="HOME",$D(^%ZIS(1,%E,99)),$D(^%ZIS(1,+^(99),0)) S %A=$P(^(0),"^",1)
42RD W !,$S($D(%IS("A")):%IS("A"),1:"DEVICE: ") W:%A]"" %A,"// " D SBR S:%X="" %X=%A S %ZISVT=%X
43 I %X?2"?".E D EN2^%ZIS7 G R
44 I %X?1"?".E D EN1^%ZIS7 G R
45 I $D(DTOUT)!$D(DUOUT)!(%X'?.ANP)!($L($P(%X,";"))>31) S:%IS["T" IO="" S POP=1 Q
46 S:%X'?1.UNP %X=$$UP(%X) D SETQ G R:$T Q
47SETQ S %Y=$P(%X,";",2,9),%X=$P(%X,";",1) S:$L(";"_%Y,";/")=2 IO("P")=$P(";"_%Y,";/",2)
48 I %IS["Q",%X="Q" S %X=%Y,%ZISVT=$P(%ZISVT,";",2,9),%ZISB=0,IO("Q")=1,%IS("A")="DEVICE: " S:$D(IOP) %Y=$P(%X,";",2,9),%X=$P(%X,";",1)
49 I $T,'$D(IOP) W "UEUE TO PRINT ON" Q ; Return $T value
50 Q
51LKUP S %ZISMY=$P(%ZISVT,";",2,999),%ZISVT=$P(%ZISVT,";")
52 I %X="H" W:'$D(IOP) "ome" S %X=0
53 I 0[%X!(%X="HOME")!(%X=$I) S %A=%H Q
54 I $E(%ZISVT)="`",$D(IOP) S %A=+$E(%ZISVT,2,999) I $G(^%ZIS(1,%A,0))]"" Q
55 S %A=0 I "P"[%X Q:$D(IOP)&('$D(^%ZIS(1,%E,99))) I $D(^%ZIS(1,%E,99)) S %A=+^(99) Q
56 I %X=" ",$D(DUZ)#2,$D(^DISV(+DUZ,"^%ZIS(1,")) S %A=^("^%ZIS(1,") Q
57 S %A=+$O(^%ZIS(1,"B",%ZISVT,0)) Q:%A>0 ;mixed case lookup
58 I %X'=%ZISVT S %A=+$O(^%ZIS(1,"B",%X,0)) Q:%A>0 ;uppercase lookup
59 D VTLKUP^%ZIS S %A=%E Q:%A>0 ;mixed case lookup
60 I %X'=%ZISVT S %ZISVT=%X D VTLKUP^%ZIS S %A=%E Q:%A>0 ;uppercase lookup
61 N %XX,%YY S %XX=%X D 1^%ZIS5 S %A=+%YY Q
62SBR K DFOUT,DTOUT,DUOUT R %X:$S($D(DTIME)#2:DTIME,1:300) E W $C(7) S DTOUT=1 Q
63 S:%X="."!(%X="^") DUOUT=1,%X="" Q
64LC S %X=$$UP(%X)
65 Q
66LOW(%) Q $TR(%,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
67UP(%) Q $TR(%,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
68 ;
69 ;Call/Return % = 1 (yes), 2 (no) -1 (^)
70YN W "? ",$P("Yes// ^No// ",U,%)
71RYN R %X:$S($D(DTIME):DTIME,$D(%ZISDTIM):%ZISDTIM,1:300) E S DTOUT=1,%X=U W $C(7)
72 S:%X]""!'% %=$A(%X),%=$S(%=89:1,%=121:1,%=78:2,%=110:2,%=94:-1,1:0)
73 I '%,%X'?."?" W $C(7),"??",!?4,"ANSWER 'Yes' OR 'No': " G RYN
74 W:$X>73 ! W $P(" (Yes)^ (No)",U,%)
75 Q
76MSG1 I '$D(IOP) W ?20,$C(7)," [DEVICE DOES NOT EXIST]"
77 Q
78SETVAR ;Come here to setup the variables for the selected device
79 S:$D(IO)[0 IO="" G KILVAR:%IS["T"&(IO="")
80 I $G(%Z)="" S ION="Unknown device",POP=1 G KILVAR
81 S:IO'=IO(0)&($D(DUZ)#2) ^DISV(+DUZ,"^%ZIS(1,")=%E
82 S ION=$P(%Z,"^",1),IOM=+%Z91,IOF=$P(%Z91,"^",2),IOSL=$P(%Z91,"^",3),IOBS=$P(%Z91,"^",4),IOXY=$P(%Z91,"^",5)
83 I IOSL>65530 S IOSL=65530 ;Cache rolls $Y at 65535
84 S IOT=%ZTYPE,IOST(0)=%ZISIOST(0),IOST=%ZISIOST,IOPAR=%ZISOPAR,IOUPAR=%ZISUPAR,IOHG=%ZISHG
85 S:IOF="" IOF="#" ;See that IOF has something
86 K IOCPU S:$D(%ZISCPU) IOCPU=%ZISCPU
87 G KIL
88 ;
89KILVAR ;Come here to restore the calling variables
90 D SYMBOL^%ZISUTL(1,"%ZISOLD")
91 S:'$L($G(IOF)) IOF="#" S:'$D(IOST(0)) IOST(0)=0
92 ;See that all standard variables are defined
93 F %I="IO","ION","IOM","IOBS","IOSL","IOST" S:$D(@%I)[0 @%I=""
94 K IO("HFSIO"),IO("OPEN") I $D(%ZISCPU) S:'$D(IOCPU) IOCPU=%ZISCPU
95KIL ;Final exit cleanup
96 S:'POP IOS=%ZISIOS I POP K:%IS'["T" %ZISIOS I %IS["T" K IOS S:$D(%ZISIOS) IOS=%ZISIOS
97 S:%IS["T" IO("T")=1 K %ZIS,%IS,%A,%E,%H,%ZISOS,%ZISV,IOP
98K2 K %I,%X,%Y,%Z,%Z1,%Z91,%Z95,%ZTYPE,%ZTIME
99 K %ZISCHK,%ZISCPU,%ZISI,%ZISR,%ZISVT,%ZISB,%ZISX,ZISI,%ZISHGL,%ZISHP,%ZISIO,%ZISIOS,%ZISIOM
100 K %ZISIOF,%ZISIOSL,%ZISIOBS,%ZISIOST,%ZISIOST(0),%ZISTO,%ZISTP,%ZISHG,%ZISSIO,%ZISOPEN,%ZISOPAR,%ZISUPAR
101 K %ZISMY,%ZISQUIT,%ZISLOCK
102 Q
Note: See TracBrowser for help on using the repository browser.