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/ZIS4VXD.m@ 1704

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

initial load of WorldVistAEHR

File size: 4.0 KB
Line 
1%ZIS4 ;SFISC/AC,RWF,MVB - DEVICE HANDLER SPOOL SPECIFIC CODE(VAX DSM) ;10/11/2001 10:44
2 ;;8.0;KERNEL;**23,36,49,59,69,191**;JUL 03, 1995
3 ;
4OPEN G OPN2:$D(IO(1,IO))
5 S POP=0 D OP1 G NOPEN:'$D(IO(1,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 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 S POP=1 Q
11 Q
12OP1 S $ZT="OPNERR^%ZIS4",$ZE=""
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
16OPNERR S POP=1,IO("LASTERR")=$G(IO("ERROR")),IO("ERROR")=$ZE,$EC="" Q
17 ;
18O D:%IS["L" ZIO
19 ;D:$D(%ZISIOS) ZISLPC^%ZIS Q:'%ZISB ;No longer called in Kernel v8.
20LCKGBL ;Lock Global
21 I %ZTYPE="CHAN" N % S %=$G(^%ZIS(1,+%E,"GBL")) I %]"" L @("+^"_%_":0") S:'$T POP=1 I POP W:'$D(IOP) !,?5,*7,"[DEVICE IS BUSY]" Q
22 I $D(IO("S")),$D(^%ZIS(2,IO("S"),10)),^(10)]"" U IO(0) D X10^ZISX
23OPAR I $D(IOP),%ZTYPE="HFS",$D(%IS("HFSIO")),$D(%IS("IOPAR")),%IS("HFSIO")]"" S IO=%IS("HFSIO"),%ZISOPAR=%IS("IOPAR")
24 I %ZTYPE="CHAN",IO["::""TASK="!(IO["SYS$NET") D ODECNET Q:POP G OXECUTE^%ZIS6
25 S %A=%ZISOPAR_$S(%ZISOPAR["):":"",%ZTYPE["CHAN"&($P(%ZTIME,"^",3)="n"):"",1:":"_%ZISTO)
26 N % S %(IO)="",%=$P($P($NA(%(IO)),"(",2),")")
27 S %A=%_$E(":",%A]"")_%A
28 D O1 I POP D Q
29 .I %ZTYPE="HFS",'$D(IOP),$G(IO("ERROR"))["file not found" W !,?5,*7,"[File Not Found]" Q
30 .W:'$D(IOP) !,?5,*7,"[DEVICE IS BUSY]" Q
31 ;S IO(1,IO)="" U IO S:'(IO=IO(0)&'$D(IO("S"))&'$D(ZTQUEUED)) $X=0,$Y=0 I %ZTYPE["TRM" U IO:(WIDTH=+%Z91)
32 U IO S $X=0,$Y=0 I %ZTYPE["TRM" U IO:(WIDTH=+%Z91)
33 I %ZISUPAR]"" S %A1=""""_IO_""":"_%ZISUPAR U @%A1
34 ;U:%IS'[0 IO(0)
35 G OXECUTE^%ZIS6
36 ;
37O1 S $ZT="OPNERR^%ZIS4"
38 L:$D(%ZISLOCK) +@%ZISLOCK:60
39 O @%A S:'$T&(%A?.E1":".N) POP=1 S:'POP IO(1,IO)="" L:$D(%ZISLOCK) -@%ZISLOCK
40 S IO("ERROR")="" Q
41 ;
42ODECNET ;OPEN DECNET CHANNEL
43 S $ZT="OPNERR^%ZIS4"
44 L:$D(%ZISLOCK) +@%ZISLOCK:60 O IO L:$D(%ZISLOCK) -@%ZISLOCK
45 S IO("ERROR")=""
46 I IO="SYS$NET",$I="SYS$INPUT:;" S IO(0)=IO U IO Q
47 Q
48ZIO N % S %=$ZIO,%=$S(%["Host:":$P($P(%,"Host: ",2)," ")_":"_$P(%,"Port: ",2),1:%) S:%[" " %=$TR(%," ")
49 S IO("ZIO")=% S:($ZIO["Host:")&'$D(IO("IP")) IO("IP")=$P(%,":")
50 Q
51 ;
52SPOOL ;%ZDA=pointer to ^XMB(3.51, %ZFN=spool file name.
53 I $D(ZISDA) W:'$D(IOP) !?5,*7,"You may not Spool the printing of a Spool document" G N
54 I $D(DUZ)[0 W:'$D(IOP) !,"Must be a valid user." G N
55R 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) G OK:$D(IO("Q"))
56 G:'%ZISB OK I '$P(%ZY,"^",3),%ZFN]"" D SPL3 G N:%ZFN']"",DOC
57 S %ZFN=IO_"SPOOL_no_"_%ZDA_".TMP" D SPL2 G:%ZFN']"" N S $P(^XMB(3.51,%ZDA,0),U,2)=%ZFN,^XMB(3.51,"C",%ZFN,%ZDA)=""
58DOC S IO=%ZFN,IO("SPOOL")=%ZDA,^XUTL("XQ",$J,"SPOOL")=%ZDA,IOF="#"
59 I $D(^%ZIS(1,%ZISIOS,1)),$P(^(1),"^",8),$O(^("SPL",0)) S ^XUTL("XQ",$J,"ADSPL")=%ZISIOS,ZISPLAD=%ZISIOS
60OK K %ZDA,%ZFN Q
61N K %ZDA,%ZFN,IO("DOC") S POP=1 Q
62 ;
63SPL2 O %ZFN:(NEWVERSION:PROT=W:RWD) G:$ZA<0 SPL4 S IO(1,%ZFN)="" Q
64 ;
65SPL3 N $ETRAP S $ETRAP="S $EC="""" G SPL4^%ZIS4"
66 O %ZFN:READONLY:1 S:'$T ZISPLQ=1 G:$ZA<0!('$T) SPL4 S IO(1,%ZFN)="" Q
67 ;
68SPL4 W:'$D(IOP)&'$D(ZTQUEUED) !?5,*7,"Couldn't open the spool file." S %ZFN="" Q
69 ;
70CLOSE N %Z1 C:IO]"" IO K:IO]"" IO(1,IO) D FILE^ZISPL1 I %ZDA'>0 K ZISPLAD Q
71 S %ZFN=$P(%ZS,"^",2) D SPL3 Q:%ZFN']"" U %ZFN S %ZCR=$C(13),%Y="",$ZT="SPLEOF^%ZIS4"
72 S %Z1=+$G(^XTV(8989.3,1,"SPL"))
73 F %=0:0 R %X#255:5 Q:$ZA<0 S %2=%X D CL2 G:%Z1<% SPLEX
74SPLEOF I $ZE'["ENDO" ZQ ;Send error up
75SPLEX C %ZFN:DELETE K:%ZFN]"" IO(1,%ZFN) D CLOSE^ZISPL1 K %Y,%X,%1,%ZFN Q
76 ;
77CL2 S %=%+1 I %Z1<% S ^XMBS(3.519,XS,2,%,0)="*** INCOMPLETE REPORT -- SPOOL DOCUMENT LINE LIMIT EXCEEDED ***",$P(^XMB(3.51,%ZDA,0),"^",11)=1 Q
78 I %2[$C(12) S ^XMBS(3.519,XS,2,%,0)="|TOP|" Q
79 S ^XMBS(3.519,XS,2,%,0)=%2 Q
80 ;
81HFS G HFS^%ZISF
82REWMT(IO,IOPAR) ;Rewind Magtape
83 S X="REWERR^%ZIS4",@^%ZOSF("TRAP")
84 U IO W *5
85 Q 1
86REWSDP(IO2,IOPAR) ;Rewind SDP
87 G REW1
88REWHFS(IO2,IOPAR) ;Rewind Host File.
89REW1 ;N $ET S $ET="D REWERR^%ZIS4 Q 0"
90 U IO2:DISCONNECT
91 Q 1
92REWERR ;Error encountered
93 S IO("ERROR")=$EC,$EC=""
94 Q
Note: See TracBrowser for help on using the repository browser.