[613] | 1 | ZISPL1 ;SF/RWF - %ZIS UTILITIES FOR SPOOLING ;11/20/97 08:53
|
---|
| 2 | ;;8.0;KERNEL;**23,36,69**;Jul 10, 1995
|
---|
| 3 | ;This is general code for managment of the spooler file from %ZIS.
|
---|
| 4 | Q
|
---|
| 5 | ;
|
---|
| 6 | FILE ;Called by %ZIS4 to setup spool data file.
|
---|
| 7 | S %ZDA=$S($D(IO("SPOOL")):IO("SPOOL"),$D(^XUTL("XQ",$J,"SPOOL")):^("SPOOL"),1:0) Q:%ZDA'>0
|
---|
| 8 | I '$D(ZISPLAD),$D(^XUTL("XQ",$J,"ADSPL")) S ZISPLAD=^("ADSPL")
|
---|
| 9 | K ^XUTL("XQ",$J,"SPOOL"),^("ADSPL"),IO("SPOOL") S %ZS=$S($D(^XMB(3.51,%ZDA,0)):^(0),1:"") I %ZS']"" S %ZDA=-1 Q
|
---|
| 10 | I '$D(ZTSK) S ZTRTN="DQC^ZISPL1",ZTDESC="Background Spool Filer",ZTDTH=$H,ZTIO="",ZTSAVE("%ZDA")="" S:$D(ZISPLAD) ZTSAVE("ZISPLAD")="",ZTSAVE("%ZS")="" D ^%ZTLOAD K ZISPLAD,ZTSK S %ZDA=-1 Q
|
---|
| 11 | N X,Y K DD,DO S X=%ZDA,DIC="^XMBS(3.519,",DIC(0)="LZ",DLAYGO=3.519 D FILE^DICN S XS=+Y
|
---|
| 12 | K DD,DO,DLAYGO
|
---|
| 13 | S $P(^XMB(3.51,%ZDA,0),"^",3)="a",$P(^(0),"^",6)=DT,$P(^(0),"^",10)=XS,^XMB(3.51,"AM",XS,%ZDA)="" Q
|
---|
| 14 | ;
|
---|
| 15 | CLOSE S ^XMBS(3.519,XS,2,0)="^^"_%_"^"_%,$P(^XMB(3.51,%ZDA,0),"^",2,3)="^r",$P(^(0),"^",9)=%
|
---|
| 16 | I $D(ZISPLAD) F %=0:0 S %=$O(^%ZIS(1,+ZISPLAD,"SPL",%)) Q:%'>0 D
|
---|
| 17 | .I $D(^%ZIS(1,+ZISPLAD,"SPL",%,0)) S %X=^(0) D
|
---|
| 18 | ..S ZISPLC=$S($P(%X,"^",2)]"":+$P(%X,"^",2),1:1),%X=$P(%X,"^")
|
---|
| 19 | ..I $D(^%ZIS(1,+%X,0)) K ZISDA2 S ZISPLDV=$P(^(0),"^"),DIE="^XMB(3.51,",DR="[XU-ZISPL1]",(ZISDA,DA)=%ZDA D ADSPL
|
---|
| 20 | K ^XMB(3.51,"C",%ZFN),XMZ,XMDUZ,%ZDA,%ZFN,% Q
|
---|
| 21 | ;
|
---|
| 22 | DQC ;DQ the move from spool to mail message.
|
---|
| 23 | S IO("SPOOL")=%ZDA D CLOSE^%ZIS4 Q
|
---|
| 24 | ;
|
---|
| 25 | ADSPL N %,ZTSK D ^DIE Q:'$D(ZISDA2)
|
---|
| 26 | S %X="^"_ZISPLC_"^^^^^"_ZISPLDV_";"_$P(%ZS,"^",8)_"^"_$H
|
---|
| 27 | ;
|
---|
| 28 | QDSPL S ZISPLC=$P(%X,"^",2),ZTIO=$P(%X,"^",7),ZTDTH=$P(%X,"^",8),ZTRTN="DQP^ZISPL2",ZTDESC="Auto despool document"
|
---|
| 29 | I ZTIO]"",ZTDTH]"",ZISPLC S ZISDA=%ZDA,ZTSAVE("ZISDA")="",ZTSAVE("ZISDA2")="",ZTSAVE("ZISPLC")="" D ^%ZTLOAD K ZTSK
|
---|
| 30 | Q
|
---|
| 31 | ;
|
---|
| 32 | NEWDOC ;Called by %ZIS4 to get or setup a spool document.
|
---|
| 33 | N DIC,X,Y I $S($D(^VA(200,DUZ,"SPL")):$E(^("SPL"),1),1:"N")'["y" W:'$D(IOP) !?5,"You aren't an authorized SPOOLER user." Q
|
---|
| 34 | D LIMITS
|
---|
| 35 | I '$D(IOP),%Z1'>%Z2!($P(%Z1,"^",2)'>%Z3) D MSG1 Q
|
---|
| 36 | R S %Y=$S($D(IO("DOC")):IO("DOC"),$G(%ZISMY)]"":$P(%ZISMY,";",1),1:$P(%Y,";",1)) K %Z1,%Z2,%Z3
|
---|
| 37 | S DIC=3.51,U="^",DIC("DR")="",DIC("S")="I '$P(^(0),U,10)",DIC("W")="W "" Status: "",$P(^(0),U,3),"" Lines: "",$P(^(0),U,9)"
|
---|
| 38 | I %IS'[0,$D(^%ZIS(1,%ZISIOS,1)),$P(^(1),"^",9) D GENDOC G R1
|
---|
| 39 | I $D(IOP) S X=%Y,DIC(0)="XMLZ"
|
---|
| 40 | E S DIC(0)="AEQMZL" S:%Y?1A.ANP DIC("B")=%Y
|
---|
| 41 | S DLAYGO=3,%ZY=-1 D ^DIC K DLAYGO Q:Y<0
|
---|
| 42 | R1 S %ZY=Y,%ZY(0)=Y(0),ZISIOST="P-OTHER",$P(%Z91,"^",2)="#" G:'$P(Y,"^",3) ND3
|
---|
| 43 | S %=$$NOW^XLFDT
|
---|
| 44 | S ^XMB(3.51,+Y,0)=$P(^XMB(3.51,+Y,0),"^",1)_"^^o^"_%_U_DUZ_"^^^"_+%Z91_";"_$P(%Z91,"^",3),^XMB(3.51,"AOK",+Y,DUZ)="",^XMB(3.51,"ADUZ",DUZ,+Y)=""
|
---|
| 45 | ND3 S %=$P(^XMB(3.51,+Y,0),"^",8),$P(%Z91,"^")=+%,$P(%Z91,"^",3)=$P(%,";",2)
|
---|
| 46 | Q
|
---|
| 47 | LIMITS S %Z1=$G(^XTV(8989.3,1,"SPL")),(%Z2,%Z3)=0
|
---|
| 48 | ;The next line only counts doc names w/ data
|
---|
| 49 | ;F %=0:0 S %=$O(^XMB(3.51,"ADUZ",DUZ,%)) Q:%'>0 S %Z4=$S($D(^XMB(3.51,%,0)):^(0),1:""),%Z2=%Z2+$P(%Z4,"^",9),%Z3=$P(%Z4,"^",10)>1+%Z3
|
---|
| 50 | ;This line counts all doc names.
|
---|
| 51 | F %=0:0 S %=$O(^XMB(3.51,"ADUZ",DUZ,%)) Q:%'>0 S %Z4=$G(^XMB(3.51,%,0)),%Z2=%Z2+$P(%Z4,"^",9),%Z3=%Z3+1
|
---|
| 52 | Q
|
---|
| 53 | GENDOC ;Auto generate document name.
|
---|
| 54 | D FLST S %ZY=$E($P(^%ZIS(1,%ZISIOS,0),"^"),1,25)
|
---|
| 55 | I %ZY["|DT|" S %ZY=$P(%ZY,"|DT|")_$$HTE^XLFDT($H,"2D")_$P(%ZY,"|DT|",2)
|
---|
| 56 | G1 S ZISPLST=ZISPLST+1,X=%ZY_"_"_+ZISPLST G G1:$D(^XMB(3.51,+ZISPLST,0)),G1:$O(^XMB(3.51,"B",X,0))>0
|
---|
| 57 | S DIC=3.51,DIC(0)="XMLZ",DINUM=+ZISPLST,DLAYGO=3
|
---|
| 58 | D ^DIC K DLAYGO I Y'>0 G G1
|
---|
| 59 | Q
|
---|
| 60 | ;
|
---|
| 61 | MSG1 W !,*7,"You have too many documents or lines, Please delete some documents" Q
|
---|
| 62 | ;
|
---|
| 63 | FLST S ZISPLST=$P($G(^XMB(3.51,0)),"^",3)
|
---|
| 64 | Q
|
---|