XUTMTDL ;SEA/RDS - TaskMan: ToolKit, Delete List ;7/21/95 08:38 [ 04/02/2003 8:29 AM ]
;;8.0;KERNEL;**1002,1003,1004,1005,1007**;APR 1, 2003
;;8.0;KERNEL;**1**;Jul 05, 1995
;
SCHED ;Lookup Tasks In Schedule File
N ZT,ZT1,ZT2,ZT3,ZT4,ZT5,ZT6,ZTF,ZTS S ZTSK=0 K ^TMP($J,"XUTMTDL")
S ZT1="" F ZT=0:0 S ZT1=$O(^%ZTSCH(ZT1)),ZT2="" Q:'ZT1 F ZT=0:0 S ZT2=$O(^%ZTSCH(ZT1,ZT2)) Q:ZT2="" S ZTS=ZT2 D SCREEN I ZTF D DQSCHED,DELETE
S ZT1="" F ZT=0:0 S ZT1=$O(^%ZTSCH("IO",ZT1)),ZT2="" Q:ZT1="" F ZT=0:0 S ZT2=$O(^%ZTSCH("IO",ZT1,ZT2)),ZT3="" Q:ZT2="" F ZT=0:0 S ZT3=$O(^%ZTSCH("IO",ZT1,ZT2,ZT3)) Q:ZT3="" S ZTS=ZT3 D SCREEN I ZTF D DQIO,DELETE
S ZT1="" F ZT=0:0 S ZT1=$O(^%ZTSCH("JOB",ZT1)),ZT2="" Q:ZT1="" F ZT=0:0 S ZT2=$O(^%ZTSCH("JOB",ZT1,ZT2)) Q:ZT2="" S ZTS=ZT2 D SCREEN I ZTF D DQJOB,DELETE
S ZT1="" F ZT=0:0 S ZT1=$O(^%ZTSCH("LINK",ZT1)),ZT2="" Q:ZT1="" F ZT=0:0 S ZT2=$O(^%ZTSCH("LINK",ZT1,ZT2)),ZT3="" Q:ZT2="" F ZT=0:0 S ZT3=$O(^%ZTSCH("LINK",ZT1,ZT2,ZT3)) Q:ZT3="" S ZTS=ZT3 D SCREEN I ZTF D DQLINK,DELETE
;
TASK ;delete unscheduled tasks in Task file
S ZT1="" F ZT=0:0 S ZT1=$O(^TMP($J,"XUTMT",ZT1)) Q:ZT1="" D RANGE:$D(^(ZT1))=10 I $D(^TMP($J,"XUTMT",ZT1))=1,$D(^%ZTSK(ZT1)) S ZTS=ZT1 D SCREEN I ZTF D DELETE
K ^TMP($J,"XUTMTDL") Q
;
RANGE ;TASK--process a range
S ZT3=ZT1,(ZT2,ZTS)=$O(^TMP($J,"XUTMT",ZT1,""))
I $D(^%ZTSK(ZTS)) D SCREEN I ZTF D DELETE
F ZT=0:0 S ZTS=$O(^%ZTSK(ZTS)) Q:ZTS>ZT3!'ZTS D SCREEN I ZTF D DELETE
Q
;
SCREEN ;Screen Tasks For Selection & User Authority To Select
L +^%ZTSK(ZTS)
S ZTF=0 I '$D(^TMP($J,"XUTMT",ZTS)) S ZT5=$O(^TMP($J,"XUTMT",ZTS)) G SCRX:ZT5="" S ZT6=$O(^(ZT5,"")) G SCRX:ZT6>ZTS!'ZT6
I 'ZTKEY I $S($D(^%ZTSK(ZTS,0))[0:1,$P(^%ZTSK(ZTS,0),U,11)_","_$P(^(0),U,12)=XUTMUCI:DUZ'=$P(^(0),U,3),1:ZTNAME'=$P(^(0),U,10)) G SCRX
S ZTF=1
SCRX L -^%ZTSK(ZTS) Q
;
DQSCHED ;Dequeue A Schedule List Entry
L +^%ZTSCH(ZT1,ZT2) K ^%ZTSCH(ZT1,ZT2) L -^%ZTSCH(ZT1,ZT2) Q
;
DQIO ;Dequeue A Device Waiting List
N %ZTIO,ZTDTH,ZTSK S %ZTIO=ZT1,ZTDTH=ZT2,ZTSK=ZT3 L +^%ZTSK(ZTSK),+^%ZTSCH("IO") D DQ^%ZTM4 L -^%ZTSCH("IO"),-^%ZTSK(ZTSK) Q
;
DQJOB ;Dequeue A Submanager Waiting List Entry
L +^%ZTSK(ZT2),+^%ZTSCH("JOB",ZT1,ZT2) K ^%ZTSCH("JOB",ZT1,ZT2) L -^%ZTSCH("JOB"),-^%ZTSK(ZT2) Q
;
DQLINK ;Dequeue A Link Waiting List Entry
L +^%ZTSCH("LINK") K ^%ZTSCH("LINK",ZT1,ZT2,ZT3) L -^%ZTSCH("LINK") Q
;
DELETE ;Delete Unscreened Tasks That Are Not Currently Running
L +^%ZTSK(ZTS) I '$D(^%ZTSCH("TASK",ZTS)) K ^%ZTSK(ZTS) I '$D(^TMP($J,"XUTMTDL",ZTS)) S ^(ZTS)="",ZTSK=ZTSK+1
L -^%ZTSK(ZTS) Q
;
XUTMTDL ;SEA/RDS - TaskMan: ToolKit, Delete List ;7/21/95 08:38 [ 04/02/2003 8:29 AM ]
+1 ;;8.0;KERNEL;**1002,1003,1004,1005,1007**;APR 1, 2003
+2 ;;8.0;KERNEL;**1**;Jul 05, 1995
+3 ;
SCHED ;Lookup Tasks In Schedule File
+1 NEW ZT,ZT1,ZT2,ZT3,ZT4,ZT5,ZT6,ZTF,ZTS
SET ZTSK=0
KILL ^TMP($JOB,"XUTMTDL")
+2 SET ZT1=""
FOR ZT=0:0
SET ZT1=$ORDER(^%ZTSCH(ZT1))
SET ZT2=""
IF 'ZT1
QUIT
FOR ZT=0:0
SET ZT2=$ORDER(^%ZTSCH(ZT1,ZT2))
IF ZT2=""
QUIT
SET ZTS=ZT2
DO SCREEN
IF ZTF
DO DQSCHED
DO DELETE
+3 SET ZT1=""
FOR ZT=0:0
SET ZT1=$ORDER(^%ZTSCH("IO",ZT1))
SET ZT2=""
IF ZT1=""
QUIT
FOR ZT=0:0
SET ZT2=$ORDER(^%ZTSCH("IO",ZT1,ZT2))
SET ZT3=""
IF ZT2=""
QUIT
FOR ZT=0:0
SET ZT3=$ORDER(^%ZTSCH("IO",ZT1,ZT2,ZT3))
IF ZT3=""
QUIT
SET ZTS=ZT3
DO SCREEN
IF ZTF
DO DQIO
DO DELETE
+4 SET ZT1=""
FOR ZT=0:0
SET ZT1=$ORDER(^%ZTSCH("JOB",ZT1))
SET ZT2=""
IF ZT1=""
QUIT
FOR ZT=0:0
SET ZT2=$ORDER(^%ZTSCH("JOB",ZT1,ZT2))
IF ZT2=""
QUIT
SET ZTS=ZT2
DO SCREEN
IF ZTF
DO DQJOB
DO DELETE
+5 SET ZT1=""
FOR ZT=0:0
SET ZT1=$ORDER(^%ZTSCH("LINK",ZT1))
SET ZT2=""
IF ZT1=""
QUIT
FOR ZT=0:0
SET ZT2=$ORDER(^%ZTSCH("LINK",ZT1,ZT2))
SET ZT3=""
IF ZT2=""
QUIT
FOR ZT=0:0
SET ZT3=$ORDER(^%ZTSCH("LINK",ZT1,ZT2,ZT3))
IF ZT3=""
QUIT
SET ZTS=ZT3
DO SCREEN
IF ZTF
DO DQLINK
DO DELETE
+6 ;
TASK ;delete unscheduled tasks in Task file
+1 SET ZT1=""
FOR ZT=0:0
SET ZT1=$ORDER(^TMP($JOB,"XUTMT",ZT1))
IF ZT1=""
QUIT
IF $DATA(^(ZT1))=10
DO RANGE
IF $DATA(^TMP($JOB,"XUTMT",ZT1))=1
IF $DATA(^%ZTSK(ZT1))
SET ZTS=ZT1
DO SCREEN
IF ZTF
DO DELETE
+2 KILL ^TMP($JOB,"XUTMTDL")
QUIT
+3 ;
RANGE ;TASK--process a range
+1 SET ZT3=ZT1
SET (ZT2,ZTS)=$ORDER(^TMP($JOB,"XUTMT",ZT1,""))
+2 IF $DATA(^%ZTSK(ZTS))
DO SCREEN
IF ZTF
DO DELETE
+3 FOR ZT=0:0
SET ZTS=$ORDER(^%ZTSK(ZTS))
IF ZTS>ZT3!'ZTS
QUIT
DO SCREEN
IF ZTF
DO DELETE
+4 QUIT
+5 ;
SCREEN ;Screen Tasks For Selection & User Authority To Select
+1 LOCK +^%ZTSK(ZTS)
+2 SET ZTF=0
IF '$DATA(^TMP($JOB,"XUTMT",ZTS))
SET ZT5=$ORDER(^TMP($JOB,"XUTMT",ZTS))
IF ZT5=""
GOTO SCRX
SET ZT6=$ORDER(^(ZT5,""))
IF ZT6>ZTS!'ZT6
GOTO SCRX
+3 IF 'ZTKEY
IF $SELECT($DATA(^%ZTSK(ZTS,0))[0:1,$PIECE(^%ZTSK(ZTS,0),U,11)_","_$PIECE(^(0),U,12)=XUTMUCI:DUZ'=$PIECE(^(0),U,3),1:ZTNAME'=$PIECE(^(0),U,10))
GOTO SCRX
+4 SET ZTF=1
SCRX LOCK -^%ZTSK(ZTS)
QUIT
+1 ;
DQSCHED ;Dequeue A Schedule List Entry
+1 LOCK +^%ZTSCH(ZT1,ZT2)
KILL ^%ZTSCH(ZT1,ZT2)
LOCK -^%ZTSCH(ZT1,ZT2)
QUIT
+2 ;
DQIO ;Dequeue A Device Waiting List
+1 NEW %ZTIO,ZTDTH,ZTSK
SET %ZTIO=ZT1
SET ZTDTH=ZT2
SET ZTSK=ZT3
LOCK +^%ZTSK(ZTSK),+^%ZTSCH("IO")
DO DQ^%ZTM4
LOCK -^%ZTSCH("IO"),-^%ZTSK(ZTSK)
QUIT
+2 ;
DQJOB ;Dequeue A Submanager Waiting List Entry
+1 LOCK +^%ZTSK(ZT2),+^%ZTSCH("JOB",ZT1,ZT2)
KILL ^%ZTSCH("JOB",ZT1,ZT2)
LOCK -^%ZTSCH("JOB"),-^%ZTSK(ZT2)
QUIT
+2 ;
DQLINK ;Dequeue A Link Waiting List Entry
+1 LOCK +^%ZTSCH("LINK")
KILL ^%ZTSCH("LINK",ZT1,ZT2,ZT3)
LOCK -^%ZTSCH("LINK")
QUIT
+2 ;
DELETE ;Delete Unscreened Tasks That Are Not Currently Running
+1 LOCK +^%ZTSK(ZTS)
IF '$DATA(^%ZTSCH("TASK",ZTS))
KILL ^%ZTSK(ZTS)
IF '$DATA(^TMP($JOB,"XUTMTDL",ZTS))
SET ^(ZTS)=""
SET ZTSK=ZTSK+1
+2 LOCK -^%ZTSK(ZTS)
QUIT
+3 ;