XUINTSK2 ;SFISC/RWF - Reschedule tasks in IO, JOB, LINK queues. ;11/18/94 08:00 [ 04/02/2003 8:29 AM ]
;;8.0;KERNEL;**1002,1003,1004,1005,1007**;APR 1, 2003
;;8.0;KERNEL;;Jul 10, 1995
;
A L +^%ZTSCH
D IOQ,JOB,C
L -^%ZTSCH
Q
;
IOQ ;Check the IO queue
S ZTSK="",%ZTIO="" I '$D(^%ZTSCH("IO")) Q
D I2
Q
;
I2 S %ZTIO=$O(^%ZTSCH("IO",%ZTIO)),ZTDTH="0,0" I %ZTIO="" Q
I3 S ZTDTH=$O(^%ZTSCH("IO",%ZTIO,ZTDTH)),ZTSK="" I ZTDTH'["," G I2
I5 S ZTSK=$O(^%ZTSCH("IO",%ZTIO,ZTDTH,ZTSK)) I ZTSK="" G I3
L +^%ZTSK(ZTSK) G I7:$D(^%ZTSCH("IO",%ZTIO,ZTDTH,ZTSK))[0
S ZTQUEUED=.5 D DQ^%ZTM4
S ^%ZTSCH(ZTDTH,ZTSK)="",^%ZTSK(ZTSK,.1)="1^"_$H
I7 L -^%ZTSK(ZTSK) G I5
Q
;
C ;GETTASK--On C type volume sets, get tasks from Cross-Volume Job List
S ZTCPU=""
F S ZTCPU=$O(^%ZTSCH("C",ZTCPU)) Q:ZTCPU="" D C3
Q
C3 S ZTSK="",ZTDTH="0,0"
F S ZTDTH=$O(^%ZTSCH("C",ZTCPU,ZTDTH)) Q:ZTDTH'["," D
. S ZTSK=0
. F S ZTSK=$O(^%ZTSCH("C",ZTCPU,ZTDTH,ZTSK)) Q:ZTSK="" D
.. K ^%ZTSCH("C",ZTCPU,ZTDTH,ZTSK)
.. I $D(^%ZTSK(ZTSK,0))[0!'ZTSK Q
.. S ^%ZTSCH(ZTDTH,ZTSK)=""
.. Q
. Q
Q
;
JOB ;GETTASK--search Partition Waiting List
S ZTSK="",ZTDTH="0,0"
J2 S ZTDTH=$O(^%ZTSCH("JOB",ZTDTH)),ZTSK="" I ZTDTH'["," Q
J3 S ZTSK=$O(^%ZTSCH("JOB",ZTDTH,ZTSK)) I ZTSK="" G J2
L +^%ZTSK(ZTSK) I $D(^%ZTSCH("JOB",ZTDTH,ZTSK))[0 G J7
I $D(^%ZTSK(ZTSK,0))[0!'ZTSK G J7
S ZTQUEUED=.5 K ^%ZTSCH("JOB",ZTDTH,ZTSK)
S ^%ZTSCH(ZTDTH,ZTSK)=""
J7 L -^%ZTSK(ZTSK) G J3
;
XUINTSK2 ;SFISC/RWF - Reschedule tasks in IO, JOB, LINK queues. ;11/18/94 08:00 [ 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 ;
A LOCK +^%ZTSCH
+1 DO IOQ
DO JOB
DO C
+2 LOCK -^%ZTSCH
+3 QUIT
+4 ;
IOQ ;Check the IO queue
+1 SET ZTSK=""
SET %ZTIO=""
IF '$DATA(^%ZTSCH("IO"))
QUIT
+2 DO I2
+3 QUIT
+4 ;
I2 SET %ZTIO=$ORDER(^%ZTSCH("IO",%ZTIO))
SET ZTDTH="0,0"
IF %ZTIO=""
QUIT
I3 SET ZTDTH=$ORDER(^%ZTSCH("IO",%ZTIO,ZTDTH))
SET ZTSK=""
IF ZTDTH'[","
GOTO I2
I5 SET ZTSK=$ORDER(^%ZTSCH("IO",%ZTIO,ZTDTH,ZTSK))
IF ZTSK=""
GOTO I3
+1 LOCK +^%ZTSK(ZTSK)
IF $DATA(^%ZTSCH("IO",%ZTIO,ZTDTH,ZTSK))[0
GOTO I7
+2 SET ZTQUEUED=.5
DO DQ^%ZTM4
+3 SET ^%ZTSCH(ZTDTH,ZTSK)=""
SET ^%ZTSK(ZTSK,.1)="1^"_$HOROLOG
I7 LOCK -^%ZTSK(ZTSK)
GOTO I5
+1 QUIT
+2 ;
C ;GETTASK--On C type volume sets, get tasks from Cross-Volume Job List
+1 SET ZTCPU=""
+2 FOR
SET ZTCPU=$ORDER(^%ZTSCH("C",ZTCPU))
IF ZTCPU=""
QUIT
DO C3
+3 QUIT
C3 SET ZTSK=""
SET ZTDTH="0,0"
+1 FOR
SET ZTDTH=$ORDER(^%ZTSCH("C",ZTCPU,ZTDTH))
IF ZTDTH'[","
QUIT
Begin DoDot:1
+2 SET ZTSK=0
+3 FOR
SET ZTSK=$ORDER(^%ZTSCH("C",ZTCPU,ZTDTH,ZTSK))
IF ZTSK=""
QUIT
Begin DoDot:2
+4 KILL ^%ZTSCH("C",ZTCPU,ZTDTH,ZTSK)
+5 IF $DATA(^%ZTSK(ZTSK,0))[0!'ZTSK
QUIT
+6 SET ^%ZTSCH(ZTDTH,ZTSK)=""
+7 QUIT
End DoDot:2
+8 QUIT
End DoDot:1
+9 QUIT
+10 ;
JOB ;GETTASK--search Partition Waiting List
+1 SET ZTSK=""
SET ZTDTH="0,0"
J2 SET ZTDTH=$ORDER(^%ZTSCH("JOB",ZTDTH))
SET ZTSK=""
IF ZTDTH'[","
QUIT
J3 SET ZTSK=$ORDER(^%ZTSCH("JOB",ZTDTH,ZTSK))
IF ZTSK=""
GOTO J2
+1 LOCK +^%ZTSK(ZTSK)
IF $DATA(^%ZTSCH("JOB",ZTDTH,ZTSK))[0
GOTO J7
+2 IF $DATA(^%ZTSK(ZTSK,0))[0!'ZTSK
GOTO J7
+3 SET ZTQUEUED=.5
KILL ^%ZTSCH("JOB",ZTDTH,ZTSK)
+4 SET ^%ZTSCH(ZTDTH,ZTSK)=""
J7 LOCK -^%ZTSK(ZTSK)
GOTO J3
+1 ;