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

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

initial load of WorldVistAEHR

File size: 3.3 KB
Line 
1%ZIS4 ;SFISC/GFT,RWF,AC - DEVICE HANDLER SPOOL SPECIFIC CODE (M/SQL) ;4/8/92 13:51
2 ;;8.0;KERNEL;**23**;JUL 03, 1995
3 ;
4OPEN G OPN2:$D(IO(1,IO)) I %IS["T" L +^%ZTSCH("DEV",IO):0 G NOPEN:'$T,NOPEN:$D(^%ZTSCH("DEV",IO))#2,NOPEN:$D(^%ZTSCH("IO",IO))
5 S POP=0 D OP1 S:'POP IO(1,IO)="" G NOPEN:'$D(IO(1,IO)) I %IS["T" S ^%ZTSCH("DEV",IO)=$H L -^%ZTSCH("DEV",IO)
6OPN2 I $D(%ZISHP),'$D(IOP) W !,*7," Routing to device "_$P(^%ZIS(1,%E,0),"^",1)_$S($D(^(1)):" "_$P(^(1),"^",1)_" ",1:"")
7 Q
8NOPEN L:%IS["T" -^%ZTSCH("DEV",IO) I %IS'["D",$D(%ZISHP)!(%ZISHG]"") S POP=1 Q
9 I '$D(IOP) W *7," [BUSY]" W " ... RETRY" S %=2,U="^" D YN^%ZIS1 G OPEN:%=1
10 K:%E'=%H ^XUTL("ZISPARAM",IO)
11 S POP=1 Q
12 Q
13OP1 N X S X="OPNERR^%ZIS4",@^%ZOSF("TRAP")
14 L:$D(%ZISLOCK) +@%ZISLOCK:60
15 O IO::%ZISTO S:'$T POP=1 L:$D(%ZISLOCK) -@%ZISLOCK Q
16OPNERR S POP=1,IO("ERROR")=$ZE,IO("LASTERR")=$ZE Q
17 ;
18O ;D:$D(%ZISIOS) ZISLPC^%ZIS Q:'%ZISB ;No longer called in Kernel v8.
19OPRTPORT I $D(IO("S")),$D(^%ZIS(2,IO("S"),10)),^(10)]"" U IO(0) D X10^ZISX
20OPAR I $D(IOP),%ZTYPE="HFS",$D(%IS("HFSIO")),$D(%IS("IOPAR")),%IS("HFSIO")]"" S IO=%IS("HFSIO"),%ZISOPAR=%IS("IOPAR")
21 S %A=$S(%ZISOPAR]"":%ZISOPAR,%ZTYPE'["TRM":"",%ZISIOST?1"C".E:"("_+%Z91_":""C"")",%ZISIOST?1"PK".E:"("_+%Z91_":""P"")",1:+%Z91)
22 S %A=%A_$S(%A["):":"",%ZTYPE["OTH"&($P(%ZTIME,"^",3)="n"):"",1:":"_%ZISTO),%A=""""_IO_""""_$E(":",%A]"")_%A
23 D O1 I POP W:'$D(IOP) !,?5,*7,"[DEVICE IS BUSY]" Q
24 S IO(1,IO)="" N DX,DY S (DX,DY)=0 U IO X:$D(^%ZOSF("XY"))&'(IO=IO(0)&'$D(ZTQUEUED)) ^("XY") U:%IS'[0 IO(0) I %ZISUPAR]"" S %A1=""""_IO_""":"_%ZISUPAR U @%A1 U:%IS'[0 IO(0)
25 G OXECUTE^%ZIS6
26 ;
27O1 N X S X="OPNERR^%ZIS4",@^%ZOSF("TRAP")
28 L:$D(%ZISLOCK) +@%ZISLOCK:60
29 O @%A S:'$T&(%A?.E1":".N) POP=1 L:$D(%ZISLOCK) -@%ZISLOCK Q
30 ;
31SPOOL ;%ZDA=pointer to ^XMB(3.51, %ZFN=spool file num.
32 I '$D(^XMB(3.51,0)) W:'$D(IOP) !?5,"The spooler files are not setup in this account." G N
33 I $D(ZISDA) W:'$D(IOP) !?5,*7,"You may not Spool the printing of a Spool document" G N
34R S %ZY=-1 D NEWDOC^ZISPL1:$D(DUZ)=11 G N:%ZY'>0 S %ZDA=+%ZY,%ZFN=$P(%ZY(0),U,2),IO("DOC")=$P(%ZY(0),U,1) G OK:$D(IO("Q"))
35 G:'%ZISB OK I '$P(Y,"^",3),%ZFN D SPL3 G N:%ZFN<0,DOC
36 F %ZFN=1:1 I '$D(^XMB(3.51,"C",%ZFN))!$D(^(%ZFN,%ZDA)) Q:%ZFN<256 W:'$D(IOP) *7," DELETE SOME OTHER DOCUMENT!" G N
37 D SPL2 S $P(^XMB(3.51,%ZDA,0),U,2)=%ZFN,^XMB(3.51,"C",%ZFN,%ZDA)=""
38DOC S IO("SPOOL")=%ZDA,^XUTL("XQ",$J,"SPOOL")=%ZDA
39 I $D(^%ZIS(1,%ZISIOS,1)),$P(^(1),"^",8),$O(^("SPL",0)) S ^XUTL("XQ",$J,"ADSPL")=%ZISIOS,ZISPLAD=%ZISIOS
40OK K %ZDA,%ZFN Q
41N K %ZDA,%ZFN,IO("DOC") S POP=1 Q
42SPL2 O IO:(%ZFN:0) S IO(1,IO)="",^SPOOL(0,IO("DOC"),%ZFN)="",^SPOOL(%ZFN,0)=IO("DOC")_"{"_$H Q
43SPL3 G SPL4:'$D(^SPOOL(%ZFN,2147483647)) O IO:(%ZFN:$P(^(2147483647),"{",3)) K ^(2147483647) S IO(1,IO)="" Q
44SPL4 W:'$D(IOP) !,"Spool file already open" S %ZFN=-1 Q
45CLOSE N %Z1 C:IO=IO(0) IO K:IO=IO(0) IO(1,IO) D FILE^ZISPL1 I %ZDA'>0 K ZISPLAD Q
46 S %ZFN=$P(%ZS,"^",2),%ZCR=$C(13),%Y="",%=0,%3=$P(^SPOOL(%ZFN,2147483647),"{",3)-1
47 S %Z1=+$G(^XTV(8989.3,1,"SPL"))
48 F %2=1:1:%3 S %X=^SPOOL(%ZFN,%2),%=%+1 D LIMIT:%Z1<% Q:%Z1<% S ^XMBS(3.519,XS,2,%,0)=$S($C(13,10)[%X:"",%X[$C(12):"|TOP|",1:$P(%X,$C(13),1))
49 K ^SPOOL(%ZFN),^SPOOL(0,$P(%ZS,U,1)),%Y,%X,%1,%2,%3 D CLOSE^ZISPL1
50 Q
51LIMIT S ^XMBS(3.519,XS,2,%,0)="*** INCOMPLETE REPORT -- SPOOL DOCUMENT LINE LIMIT EXCEEDED ***",$P(^XMB(3.51,%ZDA,0),"^",11)=1 Q
52HFS G HFS^%ZISF
Note: See TracBrowser for help on using the repository browser.