[613] | 1 | %ZTMS4 ;SEA/RDS-TaskMan: Submanager, Part 6 (Setup, Cleanup) ;10 Feb 2003 3:01 pm
|
---|
| 2 | ;;8.0;KERNEL;**136,275,425**;JUL 10, 1995;Build 18
|
---|
| 3 | ;
|
---|
| 4 | RESTORE ;RUN--restore saved variables
|
---|
| 5 | ;prepare for restore, Call w/ task locked.
|
---|
| 6 | N %ZTTV,DT,IO,IOBS,IOHG,IOM,ION,IOPAR,IOS,IOSL,IOST,IOT,IOUPAR,IOXY,POP,U,XY,ZTDTH,ZTIO,ZTQUEUED,ZTRTN
|
---|
| 7 | ;
|
---|
| 8 | ;restore from old node
|
---|
| 9 | ;K ^%ZTSK(ZTSK,0,"ZTSK"),^("ZT3")
|
---|
| 10 | ;S ZT3=""
|
---|
| 11 | ;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
|
---|
| 12 | ;
|
---|
| 13 | A ;restore from new node
|
---|
| 14 | K ^%ZTSK(ZTSK,.3,"ZTSK"),^("ZT3")
|
---|
| 15 | S ZT3=""
|
---|
| 16 | ;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
|
---|
| 17 | F S ZT3=$O(^%ZTSK(ZTSK,.3,ZT3)) Q:ZT3="" D:+ZT3'=ZT3
|
---|
| 18 | . I ZT3'["(" M:$D(^(ZT3)) @ZT3=^(ZT3) Q
|
---|
| 19 | . S ZT4=$L(ZT3)
|
---|
| 20 | . I $E(ZT3,ZT4)="(" M @($E(ZT3,1,ZT4-1))=^(ZT3) Q
|
---|
| 21 | . M @($E(ZT3,1,ZT4-1)_")")=^(ZT3)
|
---|
| 22 | . Q
|
---|
| 23 | ;
|
---|
| 24 | ;cleanup
|
---|
| 25 | K %A,%B,%C,%X,%Y,%Z,ZT,ZT3
|
---|
| 26 | Q
|
---|
| 27 | ;
|
---|
| 28 | POST ;RUN--post-execution commands, Call w/ task locked.
|
---|
| 29 | I $G(ZTSTOP)=1 D TSKSTAT^%ZTMS3("D","Job asked to stop") Q
|
---|
| 30 | S X=^%ZTSK(ZTSK,.1) ;Get keep till.
|
---|
| 31 | I $S($P(X,U,8)>$H:0,$D(^%ZTSK(ZTSK,0))[0:1,$G(ZTREQ)="@":1,1:0) D KILL^%ZTM4 Q
|
---|
| 32 | N ZTUCI,ZTCPU,ZTNODE,ZTPAIR,ZTYPE,ZTRTN,ZTDESC,ZTIO,ZTDTH ;Protect current values.
|
---|
| 33 | 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
|
---|
| 34 | Q
|
---|
| 35 | ;
|
---|
| 36 | ;
|
---|
| 37 | LOGIN ;RUN--enter task in signon log
|
---|
| 38 | I '$L($T(SLOG^XUS1)) Q ;No Sign-on Log
|
---|
| 39 | N XL1
|
---|
| 40 | S XL1=$$SLOG^XUS1($P(%ZTTV,U,7),1,IOS,$P($P(%ZTTV,U),","),$P(%ZTTV,U,8))
|
---|
| 41 | S $P(%ZTTV,U,10)=XL1
|
---|
| 42 | Q
|
---|
| 43 | ;
|
---|
| 44 | LOGOUT ;RUN--set signoff time for task in signon log
|
---|
| 45 | N ZT
|
---|
| 46 | S ZT=$P(%ZTTV,"^",10) Q:ZT'>0 D LOUT^XUSCLEAN(ZT)
|
---|
| 47 | Q
|
---|
| 48 | ;
|
---|
| 49 | ALERT ;Send a alert for rejected tasks.
|
---|
| 50 | I $G(DUZ)>.9,$D(^DD(8992,.01,0)) D
|
---|
| 51 | . D SETUP^XQALERT
|
---|
| 52 | ;S ZTREQ="@"
|
---|
| 53 | Q
|
---|