%ZTLOAD6 ;SEA/RDS-TaskMan: P I: Dequeue ;12/29/94 16:02 [ 04/02/2003 8:29 AM ]
;;8.0;KERNEL;**1005,1007**;APR 1, 2003
;;8.0;KERNEL;;JUL 10, 1995
;
INPUT ;check input parameters for error conditions
I $D(ZTSK)[0 S ZTSK=""
I $D(ZTSK)>1 S ZTLOAD=ZTSK K ZTSK S ZTSK=ZTLOAD K ZTLOAD
I ZTSK<1!(ZTSK\1'=ZTSK) S ZTSK(0)=0 Q
L +^%ZTSK(ZTSK)
;
D UNSCH
QUIT ;cleanup & quit
I $D(^%ZTSK(ZTSK)),$D(DUZ)#2,DUZ]"",$D(^VA(200,DUZ,0))#2 S $P(^%ZTSK(ZTSK,.1),U,1,3)="F^"_$H_U_$P(^VA(200,DUZ,0),U)
L -^%ZTSK(ZTSK) S ZTSK(0)=1 K ZT,ZT1,ZT2,ZT3
Q
;
UNSCH ;search ^%ZTSCH & unschedule task
;Call with task locked.
N ZT1,ZT2,ZT3
S ZT1=0 F S ZT1=$O(^%ZTSCH(ZT1)) Q:'ZT1 I $D(^(ZT1,ZTSK)) S ZT2=$G(^(ZTSK)) K ^%ZTSCH(ZT1,ZTSK) I ZT2]"" S $P(^%ZTSK(ZTSK,.2),U)=ZT2
L +^%ZTSCH("JOB"):15
S ZT1="" F S ZT1=$O(^%ZTSCH("JOB",ZT1)) Q:ZT1="" I $D(^(ZT1,ZTSK)) K ^%ZTSCH("JOB",ZT1,ZTSK)
L -^%ZTSCH("JOB"),+^%ZTSCH("IO"):15
S ZT1="" F S ZT1=$O(^%ZTSCH("IO",ZT1)),ZT2="" Q:ZT1="" F S ZT2=$O(^%ZTSCH("IO",ZT1,ZT2)) Q:ZT2="" I $D(^(ZT2,ZTSK)) D DQ(ZT1,ZT2,ZTSK)
L -^%ZTSCH("IO"),+^%ZTSCH("C"):15
S ZT1="" F S ZT1=$O(^%ZTSCH("C",ZT1)),ZT2="" Q:ZT1="" F S ZT2=$O(^%ZTSCH("C",ZT1,ZT2)) Q:ZT2="" I $D(^(ZT2,ZTSK)) K ^%ZTSCH("C",ZT1,ZT2,ZTSK)
L -^%ZTSCH("C"),+^%ZTSCH("LINK")
S ZT1="" F S ZT1=$O(^%ZTSCH("LINK",ZT1)),ZT2="" Q:ZT1="" F S ZT2=$O(^%ZTSCH("LINK",ZT1,ZT2)) Q:ZT2="" I $D(^(ZT2,ZTSK)) K ^%ZTSCH("LINK",ZT1,ZT2,ZTSK)
L -^%ZTSCH("LINK")
Q
;
DQ(%ZTIO,ZTDTH,ZTSK) ;SEARCH--remove task from Device Waiting List
L +^%ZTSCH("IO") D DQ^%ZTM4 L -^%ZTSCH("IO")
Q
;
%ZTLOAD6 ;SEA/RDS-TaskMan: P I: Dequeue ;12/29/94 16:02 [ 04/02/2003 8:29 AM ]
+1 ;;8.0;KERNEL;**1005,1007**;APR 1, 2003
+2 ;;8.0;KERNEL;;JUL 10, 1995
+3 ;
INPUT ;check input parameters for error conditions
+1 IF $DATA(ZTSK)[0
SET ZTSK=""
+2 IF $DATA(ZTSK)>1
SET ZTLOAD=ZTSK
KILL ZTSK
SET ZTSK=ZTLOAD
KILL ZTLOAD
+3 IF ZTSK<1!(ZTSK\1'=ZTSK)
SET ZTSK(0)=0
QUIT
+4 LOCK +^%ZTSK(ZTSK)
+5 ;
+6 DO UNSCH
QUIT ;cleanup & quit
+1 IF $DATA(^%ZTSK(ZTSK))
IF $DATA(DUZ)#2
IF DUZ]""
IF $DATA(^VA(200,DUZ,0))#2
SET $PIECE(^%ZTSK(ZTSK,.1),U,1,3)="F^"_$HOROLOG_U_$PIECE(^VA(200,DUZ,0),U)
+2 LOCK -^%ZTSK(ZTSK)
SET ZTSK(0)=1
KILL ZT,ZT1,ZT2,ZT3
+3 QUIT
+4 ;
UNSCH ;search ^%ZTSCH & unschedule task
+1 ;Call with task locked.
+2 NEW ZT1,ZT2,ZT3
+3 SET ZT1=0
FOR
SET ZT1=$ORDER(^%ZTSCH(ZT1))
IF 'ZT1
QUIT
I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