%ZTMS4 ;SEA/RDS-TaskMan: Submanager, Part 6 (Setup, Cleanup) ;10 Feb 2003 3:01 pm
;;8.0;KERNEL;**136,275,425**;JUL 10, 1995;Build 18
;
RESTORE ;RUN--restore saved variables
;prepare for restore, Call w/ task locked.
N %ZTTV,DT,IO,IOBS,IOHG,IOM,ION,IOPAR,IOS,IOSL,IOST,IOT,IOUPAR,IOXY,POP,U,XY,ZTDTH,ZTIO,ZTQUEUED,ZTRTN
;
;restore from old node
;K ^%ZTSK(ZTSK,0,"ZTSK"),^("ZT3")
;S ZT3=""
;F ZT=0:0 S ZT3=$O(^%ZTSK(ZTSK,0,ZT3)) Q:ZT3="" I +ZT3'=ZT3 S:$D(^(ZT3))#2 @ZT3=^(ZT3) I $D(^(ZT3))>9 S %X="^%ZTSK(ZTSK,0,ZT3,",%Y=ZT3_$E("(",ZT3'["(") D %XY^%RCR
;
A ;restore from new node
K ^%ZTSK(ZTSK,.3,"ZTSK"),^("ZT3")
S ZT3=""
;F S ZT3=$O(^%ZTSK(ZTSK,.3,ZT3)) Q:ZT3="" I +ZT3'=ZT3 S:$D(^(ZT3))#2 @ZT3=^(ZT3) I $D(^(ZT3))>9 S %X="^%ZTSK(ZTSK,.3,ZT3,",%Y=ZT3_$E("(",ZT3'["(") D %XY^%RCR
F S ZT3=$O(^%ZTSK(ZTSK,.3,ZT3)) Q:ZT3="" D:+ZT3'=ZT3
. I ZT3'["(" M:$D(^(ZT3)) @ZT3=^(ZT3) Q
. S ZT4=$L(ZT3)
. I $E(ZT3,ZT4)="(" M @($E(ZT3,1,ZT4-1))=^(ZT3) Q
. M @($E(ZT3,1,ZT4-1)_")")=^(ZT3)
. Q
;
;cleanup
K %A,%B,%C,%X,%Y,%Z,ZT,ZT3
Q
;
POST ;RUN--post-execution commands, Call w/ task locked.
I $G(ZTSTOP)=1 D TSKSTAT^%ZTMS3("D","Job asked to stop") Q
S X=^%ZTSK(ZTSK,.1) ;Get keep till.
I $S($P(X,U,8)>$H:0,$D(^%ZTSK(ZTSK,0))[0:1,$G(ZTREQ)="@":1,1:0) D KILL^%ZTM4 Q
N ZTUCI,ZTCPU,ZTNODE,ZTPAIR,ZTYPE,ZTRTN,ZTDESC,ZTIO,ZTDTH ;Protect current values.
I $D(ZTREQ)#2 S ZTDTH=$P(ZTREQ,U),ZTIO=$P(ZTREQ,U,2),ZTDESC=$P(ZTREQ,U,3),ZTRTN=$P(ZTREQ,U,4,5),ZTIO(1)=$P(ZTREQ,U,6) S:$P(ZTRTN,U,2)="" ZTRTN=$P(ZTRTN,U) D REQ^%ZTLOAD Q
Q
;
;
LOGIN ;RUN--enter task in signon log
I '$L($T(SLOG^XUS1)) Q ;No Sign-on Log
N XL1
S XL1=$$SLOG^XUS1($P(%ZTTV,U,7),1,IOS,$P($P(%ZTTV,U),","),$P(%ZTTV,U,8))
S $P(%ZTTV,U,10)=XL1
Q
;
LOGOUT ;RUN--set signoff time for task in signon log
N ZT
S ZT=$P(%ZTTV,"^",10) Q:ZT'>0 D LOUT^XUSCLEAN(ZT)
Q
;
ALERT ;Send a alert for rejected tasks.
I $G(DUZ)>.9,$D(^DD(8992,.01,0)) D
. D SETUP^XQALERT
;S ZTREQ="@"
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HZTMS4 2015 printed Dec 13, 2024@02:16:30 Page 2
%ZTMS4 ;SEA/RDS-TaskMan: Submanager, Part 6 (Setup, Cleanup) ;10 Feb 2003 3:01 pm
+1 ;;8.0;KERNEL;**136,275,425**;JUL 10, 1995;Build 18
+2 ;
RESTORE ;RUN--restore saved variables
+1 ;prepare for restore, Call w/ task locked.
+2 NEW %ZTTV,DT,IO,IOBS,IOHG,IOM,ION,IOPAR,IOS,IOSL,IOST,IOT,IOUPAR,IOXY,POP,U,XY,ZTDTH,ZTIO,ZTQUEUED,ZTRTN
+3 ;
+4 ;restore from old node
+5 ;K ^%ZTSK(ZTSK,0,"ZTSK"),^("ZT3")
+6 ;S ZT3=""
+7 ;F ZT=0:0 S ZT3=$O(^%ZTSK(ZTSK,0,ZT3)) Q:ZT3="" I +ZT3'=ZT3 S:$D(^(ZT3))#2 @ZT3=^(ZT3) I $D(^(ZT3))>9 S %X="^%ZTSK(ZTSK,0,ZT3,",%Y=ZT3_$E("(",ZT3'["(") D %XY^%RCR
+8 ;
A ;restore from new node
+1 KILL ^%ZTSK(ZTSK,.3,"ZTSK"),^("ZT3")
+2 SET ZT3=""
+3 ;F S ZT3=$O(^%ZTSK(ZTSK,.3,ZT3)) Q:ZT3="" I +ZT3'=ZT3 S:$D(^(ZT3))#2 @ZT3=^(ZT3) I $D(^(ZT3))>9 S %X="^%ZTSK(ZTSK,.3,ZT3,",%Y=ZT3_$E("(",ZT3'["(") D %XY^%RCR
+4 FOR
SET ZT3=$ORDER(^%ZTSK(ZTSK,.3,ZT3))
if ZT3=""
QUIT
if +ZT3'=ZT3
Begin DoDot:1
+5 IF ZT3'["("
if $DATA(^(ZT3))
MERGE @ZT3=^(ZT3)
QUIT
+6 SET ZT4=$LENGTH(ZT3)
+7 IF $EXTRACT(ZT3,ZT4)="("
MERGE @($EXTRACT(ZT3,1,ZT4-1))=^(ZT3)
QUIT
+8 MERGE @($EXTRACT(ZT3,1,ZT4-1)_")")=^(ZT3)
+9 QUIT
End DoDot:1
+10 ;
+11 ;cleanup
+12 KILL %A,%B,%C,%X,%Y,%Z,ZT,ZT3
+13 QUIT
+14 ;
POST ;RUN--post-execution commands, Call w/ task locked.
+1 IF $GET(ZTSTOP)=1
DO TSKSTAT^%ZTMS3("D","Job asked to stop")
QUIT
+2 ;Get keep till.
SET X=^%ZTSK(ZTSK,.1)
+3 IF $SELECT($PIECE(X,U,8)>$HOROLOG:0,$DATA(^%ZTSK(ZTSK,0))[0:1,$GET(ZTREQ)="@":1,1:0)
DO KILL^%ZTM4
QUIT
+4 ;Protect current values.
NEW ZTUCI,ZTCPU,ZTNODE,ZTPAIR,ZTYPE,ZTRTN,ZTDESC,ZTIO,ZTDTH
+5 IF $DATA(ZTREQ)#2
SET ZTDTH=$PIECE(ZTREQ,U)
SET ZTIO=$PIECE(ZTREQ,U,2)
SET ZTDESC=$PIECE(ZTREQ,U,3)
SET ZTRTN=$PIECE(ZTREQ,U,4,5)
SET ZTIO(1)=$PIECE(ZTREQ,U,6)
if $PIECE(ZTRTN,U,2)=""
SET ZTRTN=$PIECE(ZTRTN,U)
DO REQ^%ZTLOAD
QUIT
+6 QUIT
+7 ;
+8 ;
LOGIN ;RUN--enter task in signon log
+1 ;No Sign-on Log
IF '$LENGTH($TEXT(SLOG^XUS1))
QUIT
+2 NEW XL1
+3 SET XL1=$$SLOG^XUS1($PIECE(%ZTTV,U,7),1,IOS,$PIECE($PIECE(%ZTTV,U),","),$PIECE(%ZTTV,U,8))
+4 SET $PIECE(%ZTTV,U,10)=XL1
+5 QUIT
+6 ;
LOGOUT ;RUN--set signoff time for task in signon log
+1 NEW ZT
+2 SET ZT=$PIECE(%ZTTV,"^",10)
if ZT'>0
QUIT
DO LOUT^XUSCLEAN(ZT)
+3 QUIT
+4 ;
ALERT ;Send a alert for rejected tasks.
+1 IF $GET(DUZ)>.9
IF $DATA(^DD(8992,.01,0))
Begin DoDot:1
+2 DO SETUP^XQALERT
End DoDot:1
+3 ;S ZTREQ="@"
+4 QUIT