1 | %ZIS4 ;SFISC/RWF,AC - DEVICE HANDLER SPOOL SPECIFIC CODE(MSM) ;30-OCT-1997 09:28
|
---|
2 | ;;8.0;KERNEL;**23,36,49,59,69**;JUL 03, 1995
|
---|
3 | ;
|
---|
4 | OPEN G OPN2:$D(IO(1,IO))
|
---|
5 | S POP=0 D OP1 G NOPEN:'$D(IO(1,IO))
|
---|
6 | OPN2 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
|
---|
8 | NOPEN I %IS'["D",$D(%ZISHP)!(%ZISHG]"") S POP=1 Q
|
---|
9 | I '$D(IOP) W *7," [BUSY] ... RETRY" S %=2,U="^" D YN^%ZIS1 G OPEN:%=1
|
---|
10 | S POP=1 Q
|
---|
11 | Q
|
---|
12 | OP1 N X S X="OPNERR^%ZIS4",@^%ZOSF("TRAP")
|
---|
13 | L:$D(%ZISLOCK) +@%ZISLOCK:60
|
---|
14 | O IO::%ZISTO S:$T IO(1,IO)="" S:'$T POP=1 L:$D(%ZISLOCK) -@%ZISLOCK
|
---|
15 | Q
|
---|
16 | OPNERR S POP=1,IO("LASTERR")=$G(IO("ERROR")),IO("ERROR")=$ZE,$EC="" Q
|
---|
17 | ;
|
---|
18 | O I $P($ZV,"Version ",2)'<3 D:%IS["L" ZIO
|
---|
19 | ;D:$D(%ZISIOS) ZISLPC^%ZIS Q:'%ZISB ;No longer called in Kernel v8.
|
---|
20 | I $D(IO("S")),$D(^%ZIS(2,IO("S"),10)),^(10)]"" U IO(0) D X10^ZISX ;Open Printer port
|
---|
21 | OPAR I $D(IOP),%ZTYPE="HFS",$D(%IS("HFSIO")),$D(%IS("IOPAR")),%IS("HFSIO")]"" S IO=%IS("HFSIO"),%ZISOPAR=%IS("IOPAR")
|
---|
22 | S %A=$S(%ZISOPAR]"":%ZISOPAR,%ZTYPE["TRM":+%Z91,1:"")
|
---|
23 | S %A=%A_$S(%A["):":"",%ZTYPE["OTH"&($P(%ZTIME,"^",3)="n"):"",1:":"_%ZISTO),%A=""""_IO_""""_$E(":",%A]"")_%A
|
---|
24 | D O1 I POP W:'$D(IOP) !,?5,*7,"[Device is BUSY]" Q
|
---|
25 | I %ZTYPE="HFS" D Q:POP
|
---|
26 | . N % S %=$I
|
---|
27 | . U IO S:$ZA<0 POP=1
|
---|
28 | . U:'$D(ZTQUEUED) % I POP C:IO]"" IO K:IO]"" IO(1,IO)
|
---|
29 | . I POP,'$D(IOP),'$D(ZTQUEUED) W !,?5,*7,"[File not Found]" Q
|
---|
30 | ;U IO S:'(IO=IO(0)&'$D(IO("S"))&'$D(ZTQUEUED)) $X=0,$Y=0
|
---|
31 | U IO S $X=0,$Y=0
|
---|
32 | I %ZISUPAR]"" S %A1=""""_IO_""":"_%ZISUPAR U @%A1
|
---|
33 | ;U:%IS'[0 IO(0)
|
---|
34 | G OXECUTE^%ZIS6
|
---|
35 | ;
|
---|
36 | O1 N X S X="OPNERR^%ZIS4",@^%ZOSF("TRAP")
|
---|
37 | L:$D(%ZISLOCK) +@%ZISLOCK:60
|
---|
38 | O @%A S:'$T&(%A?.E1":".N) POP=1 S:'POP IO(1,IO)="" L:$D(%ZISLOCK) -@%ZISLOCK
|
---|
39 | S IO("ERROR")="" Q
|
---|
40 | ;
|
---|
41 | ZIO N % S (IO("ZIO"),%)=$ZDEV($I),%=$S(%?1.3N1P.E:$TR(%,"~",":"),1:%)
|
---|
42 | S:(%?1.3N1P1.3N1P.E)&'$D(IO("IP")) IO("IP")=$TR(%,"~",":") S:(%?1A.ANP1"~"1.4N)&'$D(IO("CLNM")) IO("CLNM")=$TR($$LOW^%ZIS1(%),"~",":")
|
---|
43 | Q
|
---|
44 | ;
|
---|
45 | SPOOL ;%ZDA=pointer to ^XMB(3.51, %ZFN=spool file name.
|
---|
46 | I $D(ZISDA) W:'$D(IOP) !?5,*7,"You may not Spool the printing of a Spool document" G N
|
---|
47 | I $D(DUZ)[0 W:'$D(IOP) !,"Must be a valid user." G N
|
---|
48 | S ZOSFV=($P($ZV,"Version ",2)'<2)
|
---|
49 | R S %ZY=-1 D NEWDOC^ZISPL1 G N:%ZY'>0 S %ZDA=+%ZY,%ZFN=$P(%ZY(0),U,2),IO("DOC")=$P(%ZY(0),U,1) I '%ZISB!$D(IO("Q")) S:'ZOSFV IO=51 G OK
|
---|
50 | I '$P(%ZY,"^",3),%ZFN D SPL3 G N:'%ZFN,DOC
|
---|
51 | S %ZFN=-1 D SPL2 G:%ZFN<0 N S $P(^XMB(3.51,%ZDA,0),U,2)=%ZFN,^XMB(3.51,"C",%ZFN,%ZDA)=""
|
---|
52 | DOC S IO("SPOOL")=%ZDA,^XUTL("XQ",$J,"SPOOL")=%ZDA,IOF="#"
|
---|
53 | I $D(^%ZIS(1,%ZISIOS,1)),$P(^(1),"^",8),$O(^("SPL",0)) S ^XUTL("XQ",$J,"ADSPL")=%ZISIOS,ZISPLAD=%ZISIOS
|
---|
54 | OK K %ZDA,%ZFN Q
|
---|
55 | N K %ZDA,%ZFN,IO("DOC") S POP=1 Q
|
---|
56 | ;
|
---|
57 | SPL2 O 2:1 G SPL5:$ZA<0,SPL5:$ZC S %ZFN=$ZA#256 S IO(1,2)="",IO(1,2,"%ZFN")=%ZFN Q
|
---|
58 | ;
|
---|
59 | SPL3 Q:$D(IO(1,2))#2 O 2:%ZFN+256 G:$ZA<0 SPL5:$ZA<0,SPL5:$ZC S IO(1,2)="",IO(1,2,"%ZFN")=%ZFN Q
|
---|
60 | SPL4 E G SPL5
|
---|
61 | ;U IO S %ZA=$ZA U:%IS'[0 IO(0) I %ZA<0 G SPL5
|
---|
62 | Q
|
---|
63 | SPL5 W:'$D(IOP)&'$D(ZTQUEUED) !?5,*7,"Couldn't open the spool file." S %ZFN=-1 Q
|
---|
64 | ;
|
---|
65 | CLOSE N %Z1 S ZOSFV=($P($ZV,"Version ",2)'<2)
|
---|
66 | C 2 K IO(1,2)
|
---|
67 | D FILE^ZISPL1 I %ZDA'>0 K ZISPLAD Q
|
---|
68 | S %Z1=+$G(^XTV(8989.3,1,"SPL"))
|
---|
69 | S IO=2,%ZFN=$P(%ZS,"^",2) D SPL3 Q:%ZFN'>0 U IO S %ZCR=$C(13),%Y=""
|
---|
70 | G V2CL1^%ZOSV
|
---|
71 | Q ;Send error up
|
---|
72 | CL2 I %Z1<(%+1) S %=%+1,^XMBS(3.519,XS,2,%,0)="*** INCOMPLETE REPORT -- SPOOL DOCUMENT LINE LIMIT EXCEEDED ***",$P(^XMB(3.51,%ZDA,0),"^",11)=1 Q
|
---|
73 | I %2[$C(12) S %=%+1,^XMBS(3.519,XMZ,2,%,0)="|TOP|"
|
---|
74 | S %=%+1,^XMBS(3.519,XMZ,2,%,0)=%2 Q
|
---|
75 | ;
|
---|
76 | HFS G HFS^%ZISF
|
---|
77 | REWMT(IO,IOPAR) ;Rewind Magtape
|
---|
78 | S X="REWERR^%ZIS4",@^%ZOSF("TRAP")
|
---|
79 | U IO W *5
|
---|
80 | Q 1
|
---|
81 | REWSDP(IO,IOPAR) ;Rewind Sequential Block Processor
|
---|
82 | S X="REWERR^%ZIS4",@^%ZOSF("TRAP")
|
---|
83 | U IO:IOPAR
|
---|
84 | Q 1
|
---|
85 | REWHFS(IO,IOPAR) ;Rewind Host File.
|
---|
86 | REW1 S X="REWERR^%ZIS4",@^%ZOSF("TRAP")
|
---|
87 | U IO:(::0)
|
---|
88 | Q 1
|
---|
89 | REWERR ;Error encountered.
|
---|
90 | Q 0
|
---|