XUTMQ2 ;SEA/RDS - TaskMan: Option, XUTMINQ, Part 4 (Modules) ;6/21/95 16:25
;;8.0;KERNEL;;Jul 10, 1995
;
ENTRY G ^XUTMQ
;
PRINT ;Subroutine--Print A Task
N XUTMT,ZTSK W:'ZTC @IOF,!,ZTH,! W:'ZTF !,"-------------------------------------------------------------------------------"
S X=0,ZTC=0,ZTF=0 D EN^XUTMTP(ZTS) I $Y>18 W ! S ZTF=1,DIR(0)="E" D ^DIR S X=$D(DTOUT)!$D(DUOUT) Q:X W @IOF
S ZTC=ZTC+1 Q
;
OUT ;Tag for breaking FOR scope to exit early
Q
;
LINK ;Cross-cpu waiting lists.
N DIR,DIRUT,DTOUT,DUOUT,X,ZT,ZT1,ZT2,ZTC,ZTF,ZTH,ZTS S ZTC=0,ZTF=1,ZTH="Tasks waiting for dropped links..."
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)) Q:'ZT2 F ZTS=0:0 S ZTS=$O(^%ZTSCH("LINK",ZT1,ZT2,ZTS)) Q:'ZTS D PRINT G OUT:X
I 'ZTC W !!,"There are no tasks on this volume set that are waiting for dropped links."
W ! S DIR(0)="E",DIR("A")=$S(ZTC:"End of listing. ",1:"")_"Press RETURN to continue" D ^DIR Q
;
RUN ;Running tasks.
N XUTMT,ZTSK,ZT1
I ^%ZOSF("OS")["VAX DSM" F ZT1=0:0 D VAX1 Q:ZT1'>0
S XUTMT(0)="R4"
S XUTMT("CLEAR")=1
S XUTMT("EOL")=1
S XUTMT("HEADER")="Running tasks..."
S XUTMT("NODE")="^%ZTSCH(""TASK"","
S XUTMT("NONE")="There are no tasks listed as running."
D ^XUTMT Q
;
VAX1 ;Use VMS to help clean the TASK list
N $ETRAP,PID S $ETRAP="K ^%ZTSCH(""TASK"",ZT1) S $ECODE="""""
VAX2 S ZT1=$O(^%ZTSCH("TASK",ZT1)) Q:ZT1'>0
S PID=$P((^%ZTSCH("TASK",ZT1)),U,10) Q:'PID
S Y=$&ZLIB.%GETJPI(PID,"PID")
Q
;
FUT ;Future tasks.
N DIR,DIRUT,DTOUT,DUOUT,X,ZT,ZT1,ZT2,ZT3,ZTC,ZTF,ZTH,ZTS
K ^TMP($J)
S ZTC=0,ZTF=1,ZTH="Scheduled and waiting tasks..."
W !!,"Building sorted list of tasks..."
;
F1 S ZT1="" F S ZT1=$O(^%ZTSCH("JOB",ZT1)) Q:ZT1="" D
.S ZT2="" F S ZT2=$O(^%ZTSCH("JOB",ZT1,ZT2)) Q:'ZT2 D
.. D SORT(ZT1,ZT2) ;S ^TMP($J,99999-ZT1,99999-$P(ZT1,",",2),ZT2)=""
.Q
;
F2 S ZT1=$$H3^%ZTM($H) F S ZT1=$O(^%ZTSCH(ZT1)) Q:'ZT1 D
.S ZTS=0 F S ZTS=$O(^%ZTSCH(ZT1,ZTS)) Q:'ZTS D
.. D SORT(ZT1,ZTS) ;S ^TMP($J,99999-ZT1,99999-$P(ZT1,",",2),ZTS)=""
.Q
;
F3 S ZT1="" F S ZT1=$O(^%ZTSCH("IO",ZT1)) Q:ZT1="" D
.S ZT2="" F S ZT2=$O(^%ZTSCH("IO",ZT1,ZT2)) Q:'ZT2 D
..S ZT3=0 F S ZT3=$O(^%ZTSCH("IO",ZT1,ZT2,ZT3)) Q:ZT3="" D
... D SORT(ZT2,ZT3) ;S ^TMP($J,99999-ZT2,99999-$P(ZT2,",",2),ZT3)=""
.Q
;
F4 S ZT1="" F S ZT1=$O(^%ZTSCH("LINK",ZT1)) Q:'ZT1 D
.S ZT2="" F S ZT2=$O(^%ZTSCH("LINK",ZT1,ZT2)) Q:'ZT2 D
..S ZTS=0 F S ZTS=$O(^%ZTSCH("LINK",ZT1,ZT2,ZTS)) Q:'ZTS D
... D SORT(ZT2,ZTS) ;S ^TMP($J,99999-ZT2,99999-$P(ZT2,",",2),ZTS)=""
.Q
W "finished!"
;
F5 ;
G:$O(^TMP($J,0))="" F6
S ZTSAVE("^TMP($J,")="" D EN^XUTMDEVQ("LIST^XUTMQ","TASK LIST",.ZTSAVE)
K ^TMP($J)
Q
S ZT1="" F S ZT1=$O(^TMP($J,ZT1),-1) Q:ZT1="" D I X Q
. S ZTS=0 F S ZTS=$O(^TMP($J,ZT1,ZTS)) Q:'ZTS D PRINT I X Q
.Q
I X K ^TMP($J) Q
;
F6 I 'ZTC W !!,"There are no future tasks on this volume set."
W ! S DIR(0)="E",DIR("A")="Press RETURN to continue" D
.I ZTC S DIR("A")="End of listing. "_DIR("A")
D ^DIR K ^TMP($J) Q
;
SORT(ZTDTH,ZTSK) ;
I ZTDTH["," S ZTDTH=$$H3^%ZTM(ZTDTH)
S ^TMP($J,ZTDTH,ZTSK)=""
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HXUTMQ2 3204 printed Dec 13, 2024@02:13:31 Page 2
XUTMQ2 ;SEA/RDS - TaskMan: Option, XUTMINQ, Part 4 (Modules) ;6/21/95 16:25
+1 ;;8.0;KERNEL;;Jul 10, 1995
+2 ;
ENTRY GOTO ^XUTMQ
+1 ;
PRINT ;Subroutine--Print A Task
+1 NEW XUTMT,ZTSK
if 'ZTC
WRITE @IOF,!,ZTH,!
if 'ZTF
WRITE !,"-------------------------------------------------------------------------------"
+2 SET X=0
SET ZTC=0
SET ZTF=0
DO EN^XUTMTP(ZTS)
IF $Y>18
WRITE !
SET ZTF=1
SET DIR(0)="E"
DO ^DIR
SET X=$DATA(DTOUT)!$DATA(DUOUT)
if X
QUIT
WRITE @IOF
+3 SET ZTC=ZTC+1
QUIT
+4 ;
OUT ;Tag for breaking FOR scope to exit early
+1 QUIT
+2 ;
LINK ;Cross-cpu waiting lists.
+1 NEW DIR,DIRUT,DTOUT,DUOUT,X,ZT,ZT1,ZT2,ZTC,ZTF,ZTH,ZTS
SET ZTC=0
SET ZTF=1
SET ZTH="Tasks waiting for dropped links..."
+2 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))
if 'ZT2
QUIT
FOR ZTS=0:0
SET ZTS=$ORDER(^%ZTSCH("LINK",ZT1,ZT2,ZTS))
if 'ZTS
QUIT
DO PRINT
if X
GOTO OUT
+3 IF 'ZTC
WRITE !!,"There are no tasks on this volume set that are waiting for dropped links."
+4 WRITE !
SET DIR(0)="E"
SET DIR("A")=$SELECT(ZTC:"End of listing. ",1:"")_"Press RETURN to continue"
DO ^DIR
QUIT
+5 ;
RUN ;Running tasks.
+1 NEW XUTMT,ZTSK,ZT1
+2 IF ^%ZOSF("OS")["VAX DSM"
FOR ZT1=0:0
DO VAX1
if ZT1'>0
QUIT
+3 SET XUTMT(0)="R4"
+4 SET XUTMT("CLEAR")=1
+5 SET XUTMT("EOL")=1
+6 SET XUTMT("HEADER")="Running tasks..."
+7 SET XUTMT("NODE")="^%ZTSCH(""TASK"","
+8 SET XUTMT("NONE")="There are no tasks listed as running."
+9 DO ^XUTMT
QUIT
+10 ;
VAX1 ;Use VMS to help clean the TASK list
+1 NEW $ETRAP,PID
SET $ETRAP="K ^%ZTSCH(""TASK"",ZT1) S $ECODE="""""
VAX2 SET ZT1=$ORDER(^%ZTSCH("TASK",ZT1))
if ZT1'>0
QUIT
+1 SET PID=$PIECE((^%ZTSCH("TASK",ZT1)),U,10)
if 'PID
QUIT
+2 SET Y=$&ZLIB.%GETJPI(PID,"PID")
+3 QUIT
+4 ;
FUT ;Future tasks.
+1 NEW DIR,DIRUT,DTOUT,DUOUT,X,ZT,ZT1,ZT2,ZT3,ZTC,ZTF,ZTH,ZTS
+2 KILL ^TMP($JOB)
+3 SET ZTC=0
SET ZTF=1
SET ZTH="Scheduled and waiting tasks..."
+4 WRITE !!,"Building sorted list of tasks..."
+5 ;
F1 SET ZT1=""
FOR
SET ZT1=$ORDER(^%ZTSCH("JOB",ZT1))
if ZT1=""
QUIT
Begin DoDot:1
+1 SET ZT2=""
FOR
SET ZT2=$ORDER(^%ZTSCH("JOB",ZT1,ZT2))
if 'ZT2
QUIT
Begin DoDot:2
+2 ;S ^TMP($J,99999-ZT1,99999-$P(ZT1,",",2),ZT2)=""
DO SORT(ZT1,ZT2)
End DoDot:2
+3 QUIT
End DoDot:1
+4 ;
F2 SET ZT1=$$H3^%ZTM($HOROLOG)
FOR
SET ZT1=$ORDER(^%ZTSCH(ZT1))
if 'ZT1
QUIT
Begin DoDot:1
+1 SET ZTS=0
FOR
SET ZTS=$ORDER(^%ZTSCH(ZT1,ZTS))
if 'ZTS
QUIT
Begin DoDot:2
+2 ;S ^TMP($J,99999-ZT1,99999-$P(ZT1,",",2),ZTS)=""
DO SORT(ZT1,ZTS)
End DoDot:2
+3 QUIT
End DoDot:1
+4 ;
F3 SET ZT1=""
FOR
SET ZT1=$ORDER(^%ZTSCH("IO",ZT1))
if ZT1=""
QUIT
Begin DoDot:1
+1 SET ZT2=""
FOR
SET ZT2=$ORDER(^%ZTSCH("IO",ZT1,ZT2))
if 'ZT2
QUIT
Begin DoDot:2
+2 SET ZT3=0
FOR
SET ZT3=$ORDER(^%ZTSCH("IO",ZT1,ZT2,ZT3))
if ZT3=""
QUIT
Begin DoDot:3
+3 ;S ^TMP($J,99999-ZT2,99999-$P(ZT2,",",2),ZT3)=""
DO SORT(ZT2,ZT3)
End DoDot:3
End DoDot:2
+4 QUIT
End DoDot:1
+5 ;
F4 SET ZT1=""
FOR
SET ZT1=$ORDER(^%ZTSCH("LINK",ZT1))
if 'ZT1
QUIT
Begin DoDot:1
+1 SET ZT2=""
FOR
SET ZT2=$ORDER(^%ZTSCH("LINK",ZT1,ZT2))
if 'ZT2
QUIT
Begin DoDot:2
+2 SET ZTS=0
FOR
SET ZTS=$ORDER(^%ZTSCH("LINK",ZT1,ZT2,ZTS))
if 'ZTS
QUIT
Begin DoDot:3
+3 ;S ^TMP($J,99999-ZT2,99999-$P(ZT2,",",2),ZTS)=""
DO SORT(ZT2,ZTS)
End DoDot:3
End DoDot:2
+4 QUIT
End DoDot:1
+5 WRITE "finished!"
+6 ;
F5 ;
+1 if $ORDER(^TMP($JOB,0))=""
GOTO F6
+2 SET ZTSAVE("^TMP($J,")=""
DO EN^XUTMDEVQ("LIST^XUTMQ","TASK LIST",.ZTSAVE)
+3 KILL ^TMP($JOB)
+4 QUIT
+5 SET ZT1=""
FOR
SET ZT1=$ORDER(^TMP($JOB,ZT1),-1)
if ZT1=""
QUIT
Begin DoDot:1
+6 SET ZTS=0
FOR
SET ZTS=$ORDER(^TMP($JOB,ZT1,ZTS))
if 'ZTS
QUIT
DO PRINT
IF X
QUIT
+7 QUIT
End DoDot:1
IF X
QUIT
+8 IF X
KILL ^TMP($JOB)
QUIT
+9 ;
F6 IF 'ZTC
WRITE !!,"There are no future tasks on this volume set."
+1 WRITE !
SET DIR(0)="E"
SET DIR("A")="Press RETURN to continue"
Begin DoDot:1
+2 IF ZTC
SET DIR("A")="End of listing. "_DIR("A")
End DoDot:1
+3 DO ^DIR
KILL ^TMP($JOB)
QUIT
+4 ;
SORT(ZTDTH,ZTSK) ;
+1 IF ZTDTH[","
SET ZTDTH=$$H3^%ZTM(ZTDTH)
+2 SET ^TMP($JOB,ZTDTH,ZTSK)=""
+3 QUIT