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/ZISPL2.m@ 1154

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

initial load of WorldVistAEHR

File size: 1.6 KB
Line 
1ZISPL2 ;SF/RWF - SPOOLER CLEAN-UP ;12/03/97 14:57
2 ;;8.0;KERNEL;**23,36,69**;Jul 10, 1995
31 N DA,DIC,DIK,ZIS,ZISPL
4 K ^XMB(3.51,"AM") ;Clear X-ref first
5 S DIK="^XMB(3.51," D IXALL^DIK ;Re-Index
6 S ZISPL=$G(^XTV(8989.3,1,"SPL"),"1^1^999"),ZISDT=$$FMADD^XLFDT(DT,"-"_$P(ZISPL,"^",3))
7 F DA=0:0 S DA=$O(^XMB(3.51,DA)) Q:DA'>0 S ZIS=^XMB(3.51,DA,0) I "rpm"[$P(ZIS,"^",3),ZISDT>$S($P(ZIS,"^",6)]"":$P(ZIS,"^",6),$P(ZIS,"^",4)]"":$P(ZIS,"^",4),1:ZISDT) D DELETE
8 F DA=0:0 S DA=$O(^XMB(3.51,DA)) Q:DA'>0 S ZIS=^XMB(3.51,DA,0) I "ao"[$P(ZIS,"^",3),ZISDT>$S($P(ZIS,"^",6)]"":$P(ZIS,"^",6),$P(ZIS,"^",4)]"":$P(ZIS,"^",4),1:ZISDT) D CLOSE
9 F DA=0:0 S DA=$O(^XMBS(3.519,DA)) Q:DA'>0 I '$D(^XMB(3.51,"AM",DA)) D DSD^ZISPL(DA) ;Remove Spool data w/o Spool entry
10 Q
11DELETE ;REMOVE SPOOL DOC.
12 D DSD^ZISPL($P(ZIS,U,10)) ;Delete Spool Data entry
13 S DIK="^XMB(3.51," D ^DIK ;Delete entry
14 Q
15CLOSE ;Close a SPOOL DOC that has been open too long.
16 I $$NEWERR^%ZTER N $ESTACK,$ETRAP S $ETRAP=""
17 S X="ET^ZISPL2",@^%ZOSF("TRAP")
18 S %ZFN=$P(ZIS,"^",2),IO=%ZFN,IO("SPOOL")=DA
19 D SPL3^%ZIS4 I %ZFN="" D DELETE Q
20 X "N DA,ZIS D CLOSE^%ZIS4" Q
21ET ;TRAP ERROR.
22 D DELETE Q
23DQP Q:'$D(^XMB(3.51,ZISDA,2,ZISDA2,0))!('$D(ZISPLC)) ;Dequeue print
24 S ZISPL0=^XMB(3.51,ZISDA,0),FF="|TOP|",XS=$P(ZISPL0,U,10) Q:XS'>0
25 U IO F ZISCNT=ZISPLC:-1:1 S PG=1 D OUT S $P(^(0),U,6)=$P(^XMB(3.51,ZISDA,2,ZISDA2,0),U,6)+1
26 W:$Y>3 @IOF D NOW^%DTC S $P(^XMB(3.51,ZISDA,0),"^",3)="p",$P(^(0),"^",7)=%,$P(^XMB(3.51,ZISDA,2,ZISDA2,0),U,3,5)="^^"_%
27 D ^%ZISC G EXIT^ZISPL
28 ;
29OUT ;
30 F I=0:0 S I=$O(^XMBS(3.519,XS,2,I)) Q:I'>0 S X=^(I,0),Y=(X=FF) W:Y @IOF W:'Y X,! I Y S PG=PG+1,$P(^XMB(3.51,ZISDA,2,ZISDA2,0),"^",3,4)=PG_"^"_I
31 Q
Note: See TracBrowser for help on using the repository browser.