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S - TaskMan: ToolKit, Lookup ;11/18/94 10:27 [ 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 ;
TASK ;Lookup Task File Data
+1 SET ZTSK=XUTMT
LOCK +^%ZTSK(ZTSK)
IF '$DATA(^%ZTSK(ZTSK))
KILL XUTMT
LOCK -^%ZTSK(ZTSK)
SET ZTSK=""
QUIT
+2 SET ZTSK(0)=$SELECT($DATA(^%ZTSK(ZTSK,0))#2:^(0),1:"")
SET ZTSK(.1)=$SELECT($DATA(^(.1))#2:^(.1),1:"")
SET ZTSK(.2)=$SELECT($DATA(^(.2))#2:^(.2),1:"")
+3 NEW ZT,ZT1,ZT2,ZT3
+4 ;
SCHED ;Lookup Task In Schedule File
+1 SET ZT1=""
FOR ZT=0:0
SET ZT1=$ORDER(^%ZTSCH(ZT1))
IF 'ZT1
QUIT
IF $DATA(^%ZTSCH(ZT1,ZTSK))#2
SET ZTSK("A",ZT1,ZTSK)=""
SET ZT2=^(ZTSK)
IF ZT2]""
SET $PIECE(ZTSK(.2),U)=ZT2
+2 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))
IF ZT2=""
QUIT
IF $DATA(^(ZT2,ZTSK))#2
SET ZTSK("IO",ZT1,ZT2,ZTSK)=""
+3 SET ZT1=""
FOR ZT=0:0
SET ZT1=$ORDER(^%ZTSCH("JOB",ZT1))
IF ZT1=""
QUIT
IF $DATA(^(ZT1,ZTSK))#2
SET ZTSK("JOB",ZT1,ZTSK)=""
+4 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,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