XUTMTUL ;SEA/RDS - TaskMan: ToolKit, Unschedule List ;11/18/94 11:53 [ 04/02/2003 8:29 AM ]
;;8.0;KERNEL;**1002,1003,1004,1005,1007**;APR 1, 2003
;;8.0;KERNEL;;Jul 10, 1995
;
SCHED ;Lookup Tasks In Schedule File
N ZT,ZT1,ZT2,ZT3,ZT4,ZT5,ZT6,ZTF,ZTS S ZTSK=0 K ^TMP($J,"XUTMTUL")
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,DQSCHED:ZTF
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,DQIO:ZTF
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,DQJOB:ZTF
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,DQLINK:ZTF
K ^TMP($J,"XUTMTUL") Q
;
SCREEN ;Screen Tasks For Selection & User Authority To Select
N X
S ZTF=0 I '$D(^TMP($J,"XUTMT",ZTS)) S ZT5=$O(^TMP($J,"XUTMT",ZTS)) Q:ZT5="" S ZT6=$O(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MTUL ;SEA/RDS - TaskMan: ToolKit, Unschedule List ;11/18/94 11:53 [ 04/02/2003 8:29 AM ]
+1 ;;8.0;KERNEL;**1002,1003,1004,1005,1007**;APR 1, 2003
+2 ;;8.0;KERNEL;;Jul 10, 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,"XUTMTUL")
+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
+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
+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
+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
+6 KILL ^TMP($JOB,"XUTMTUL")
QUIT
+7 ;
SCREEN ;Screen Tasks For Selection & User Authority To Select
+1 NEW X
+2 SET ZTF=0
IF '$DATA(^TMP($JOB,"XUTMT",ZTS))
SET ZT5=$ORDER(^TMP($JOB,"XUTMT",ZTS))
IF ZT5=""
QUIT
SET ZT6=$ORDER(^(ZT5,""))
IF ZT6>ZTS!'ZT6
QUIT
+3 IF 'ZTKEY
SET X=$GET(^%ZTSK(ZTS))
IF $SELECT(X="":1,$PIECE(X,U,11)_","_$PIECE(X,U,12)=XUTMUCI:DUZ'=$PIECE(X,U,3),1:ZTNAME'=$PIECE(X,U,10))
QUIT
+4 SET ZTF=1
IF '$DATA(^TMP($JOB,"XUTMTUL",ZTS))
SET ^TMP($JOB,"XUTMTUL",ZTS)=""
SET ZTSK=ZTSK+1
QUIT
+5 ;
DQSCHED ;Dequeue A Schedule List Entry
+1 LOCK +^%ZTSK(ZT2),+^%ZTSCH(ZT1,ZT2)
+2 IF $DATA(^%ZTSCH(ZT1,ZT2))#2
SET ZT3=^(ZT2)
KILL ^(ZT2)
IF ZT3]""
IF $DATA(^%ZTSK(ZT2))
SET $PIECE(^(ZT2,.2),"^")=ZT3
+3 IF $DATA(^%ZTSK(ZT2))
SET $PIECE(^(ZT2,.1),"^",1,3)="F^"_$HOROLOG_U_ZTNAME
+4 LOCK -^%ZTSCH(ZT1,ZT2),-^%ZTSK(ZT2)
+5 QUIT
+6 ;
DQIO ;Dequeue A Device Waiting List
+1 NEW %ZTIO,ZTDTH,ZTSK
+2 SET %ZTIO=ZT1
SET ZTDTH=ZT2
SET ZTSK=ZT3
LOCK +^%ZTSK(ZTSK),+^%ZTSCH("IO")
DO DQ^%ZTM4
+3 IF $DATA(^%ZTSK(ZTSK))
SET $PIECE(^(ZTSK,.1),U,1,3)="F^"_$HOROLOG_U_ZTNAME
+4 LOCK -^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