XUTMQ1 ;SEA/RDS - TaskMan: Option, ZTMINQ, Part 3 (Modules) ;4/20/95 10:33 [ 04/02/2003 8:29 AM ]
;;8.0;KERNEL;**1002,1003,1004,1005,1007**;APR 1, 2003
;;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,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
;
RANGE ;LIST--Process A Range
S ZT1=$P(ZT,"-"),ZT2=$P(ZT,"-",2),ZTS=ZT1 I $D(^%ZTSK(ZTS))!($D(^%ZTSCH("TASK",ZTS))) D PRINT Q:X
F ZTJ=0:0 S ZTS=$O(^%ZTSCH("TASK",ZTS)) Q:ZTS=""!(ZTS>ZT2) I '$D(^%ZTSK(ZTS)) D PRINT Q:X
Q:X S ZTS=ZT1 F ZTJ=0:0 S ZTS=$O(^%ZTSK(ZTS)) Q:ZTS>ZT2!'ZTS D PRINT Q:X
Q
;
OUT ;Tag for breaking FOR scope to exit listing early
Q
;
EVERY ;Every task.
N DIR,DIRUT,DTOUT,DUOUT,X,ZT1,ZT2,ZTC,ZTF,ZTH,ZTREC,ZTS
K ^TMP($J)
S ZTC=0,ZTF=1,ZTH="Every task..."
W !!,"Building list of sorted tasks..."
;
E1 S ZTS=0 F S ZTS=$O(^%ZTSK(ZTS)) Q:'ZTS D
.S ZTREC=$G(^%ZTSK(ZTS,0)) Q:'$L(ZTREC)
. D SORT(+$P(ZTREC,U,6),ZTS)
.Q
;
E2 S ZTS=0 F S ZTS=$O(^%ZTSCH("TASK",ZTS)) Q:'ZTS D
.I $D(^%ZTSK(ZTS)) Q
. D SORT($H,ZTS) ;S ^TMP($J,99999-$H,99999-$P($H,",",2),ZTS)=""
.Q
W "finished!"
;
E3 ;
G:$O(^TMP($J,0))="" E4
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
;
E4 I 'ZTC W !!,"This volume set has no defined tasks!"
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
;
LIST ;List of tasks.
N DIR,DIRUT,DTOUT,DUOUT,X,ZT,ZT1,ZT2,ZTC,ZTF,ZTH,ZTI,ZTJ,XUTMT,ZTS,ZTSK
L0 S XUTMT(0)="AL",XUTMT("A")="Enter list to display: ",XUTMT("??")="@" D ^XUTMT K ^TMP($J,"XUTMT") Q:ZTSK="" S X=0,ZTC=0,ZTF=1,ZTH="All tasks within the list "_ZTSK_"..."
F ZTI=1:1:$L(ZTSK,",") S ZT=$P(ZTSK,",",ZTI) D RANGE:ZT["-" G OUT:X I ZT'["-",$D(^%ZTSK(ZT))!($D(^%ZTSCH("TASK",ZT))) S ZTS=ZT D PRINT G OUT:X
I ZTC W !!,"There ",$S(ZTC=1:"is ",1:"are "),ZTC," task",$S(ZTC=1:"",1:"s")," in that list."
I 'ZTC W !!?5,$S(ZTSK["-"!(ZTSK[","):"None of those tasks are ",1:"That task is not "),"defined in this volume set's Task File."
K DIR,DIRUT,DTOUT,DUOUT,X,ZT,ZT1,ZT2,ZTC,ZTF,ZTI,ZTJ,XUTMT,ZTS,ZTSK W ! G L0
;
NOT ;Unsuccessful tasks.
N DIR,DIRUT,DTOUT,DUOUT,X,ZT1,ZT2,ZTC,ZTF,ZTH,ZTS,ZTSCREEN,ZTSK
K ^TMP($J)
S X=0,ZTH="Unsuccessful tasks...",ZTC=0,ZTF=1
W !!,"Searching for unsuccessful tasks..."
;
N1 S ZTS=0 F S ZTS=$O(^%ZTSK(ZTS)) Q:'ZTS D
.I $D(^%ZTSK(ZTS,0))[0 Q
.I $D(^%ZTSK(ZTS,.1))[0 Q
.I "BCDEFIL"'[$P(^%ZTSK(ZTS,.1),U) Q
.S XUTMT=ZTS,XUTMT(0)="L" D ^XUTMT
.I '$D(ZTSK("A")),'$D(ZTSK("IO")),'$D(ZTSK("JOB")),'$D(ZTSK("LINK")),'$D(ZTSK("TASK")) D SORT(+$P(ZTSK(0),U,6),ZTS)
.Q
W "Finished!",!
;
N2 ;
G:$O(^TMP($J,0))="" N3
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 I X Q
.. D PRINT
.Q
I X K ^TMP($J) Q
;
N3 I 'ZTC W !!,"No tasks failed to run to completion."
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) ;
Q:(ZTSK'>0)!(ZTDTH'>0)
I ZTDTH["," S ZTDTH=$$H3^%ZTM(ZTDTH)
S ^TMP($J,ZTDTH,ZTSK)=""
Q
XUTMQ1 ;SEA/RDS - TaskMan: Option, ZTMINQ, Part 3 (Modules) ;4/20/95 10:33 [ 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 ;
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 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 ;
RANGE ;LIST--Process A Range
+1 SET ZT1=$PIECE(ZT,"-")
SET ZT2=$PIECE(ZT,"-",2)
SET ZTS=ZT1
IF $DATA(^%ZTSK(ZTS))!($DATA(^%ZTSCH("TASK",ZTS)))
DO PRINT
IF X
QUIT
+2 FOR ZTJ=0:0
SET ZTS=$ORDER(^%ZTSCH("TASK",ZTS))
IF ZTS=""!(ZTS>ZT2)
QUIT
IF '$DATA(^%ZTSK(ZTS))
DO PRINT
IF X
QUIT
+3 IF X
QUIT
SET ZTS=ZT1
FOR ZTJ=0:0
SET ZTS=$ORDER(^%ZTSK(ZTS))
IF ZTS>ZT2!'ZTS
QUIT
DO PRINT
IF X
QUIT
+4 QUIT
+5 ;
OUT ;Tag for breaking FOR scope to exit listing early
+1 QUIT
+2 ;
EVERY ;Every task.
+1 NEW DIR,DIRUT,DTOUT,DUOUT,X,ZT1,ZT2,ZTC,ZTF,ZTH,ZTREC,ZTS
+2 KILL ^TMP($JOB)
+3 SET ZTC=0
SET ZTF=1
SET ZTH="Every task..."
+4 WRITE !!,"Building list of sorted tasks..."
+5 ;
E1 SET ZTS=0
FOR
SET ZTS=$ORDER(^%ZTSK(ZTS))
IF 'ZTS
QUIT
Begin DoDot:1
+1 SET ZTREC=$GET(^%ZTSK(ZTS,0))
IF '$LENGTH(ZTREC)
QUIT
+2 DO SORT(+$PIECE(ZTREC,U,6),ZTS)
+3 QUIT
End DoDot:1
+4 ;
E2 SET ZTS=0
FOR
SET ZTS=$ORDER(^%ZTSCH("TASK",ZTS))
IF 'ZTS
QUIT
Begin DoDot:1
+1 IF $DATA(^%ZTSK(ZTS))
QUIT
+2 ;S ^TMP($J,99999-$H,99999-$P($H,",",2),ZTS)=""
DO SORT($HOROLOG,ZTS)
+3 QUIT
End DoDot:1
+4 WRITE "finished!"
+5 ;
E3 ;
+1 IF $ORDER(^TMP($JOB,0))=""
GOTO E4
+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 ;
E4 IF 'ZTC
WRITE !!,"This volume set has no defined tasks!"
+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 ;
LIST ;List of tasks.
+1 NEW DIR,DIRUT,DTOUT,DUOUT,X,ZT,ZT1,ZT2,ZTC,ZTF,ZTH,ZTI,ZTJ,XUTMT,ZTS,ZTSK
L0 SET XUTMT(0)="AL"
SET XUTMT("A")="Enter list to display: "
SET XUTMT("??")="@"
DO ^XUTMT
KILL ^TMP($JOB,"XUTMT")
IF ZTSK=""
QUIT
SET X=0
SET ZTC=0
SET ZTF=1
SET ZTH="All tasks within the list "_ZTSK_"..."
+1 FOR ZTI=1:1:$LENGTH(ZTSK,",")
SET ZT=$PIECE(ZTSK,",",ZTI)
IF ZT["-"
DO RANGE
IF X
GOTO OUT
IF ZT'["-"
IF $DATA(^%ZTSK(ZT))!($DATA(^%ZTSCH("TASK",ZT)))
SET ZTS=ZT
DO PRINT
IF X
GOTO OUT
+2 IF ZTC
WRITE !!,"There ",$SELECT(ZTC=1:"is ",1:"are "),ZTC," task",$SELECT(ZTC=1:"",1:"s")," in that list."
+3 IF 'ZTC
WRITE !!?5,$SELECT(ZTSK["-"!(ZTSK[","):"None of those tasks are ",1:"That task is not "),"defined in this volume set's Task File."
+4 KILL DIR,DIRUT,DTOUT,DUOUT,X,ZT,ZT1,ZT2,ZTC,ZTF,ZTI,ZTJ,XUTMT,ZTS,ZTSK
WRITE !
GOTO L0
+5 ;
NOT ;Unsuccessful tasks.
+1 NEW DIR,DIRUT,DTOUT,DUOUT,X,ZT1,ZT2,ZTC,ZTF,ZTH,ZTS,ZTSCREEN,ZTSK
+2 KILL ^TMP($JOB)
+3 SET X=0
SET ZTH="Unsuccessful tasks..."
SET ZTC=0
SET ZTF=1
+4 WRITE !!,"Searching for unsuccessful tasks..."
+5 ;
N1 SET ZTS=0
FOR
SET ZTS=$ORDER(^%ZTSK(ZTS))
IF 'ZTS
QUIT
Begin DoDot:1
+1 IF $DATA(^%ZTSK(ZTS,0))[0
QUIT
+2 IF $DATA(^%ZTSK(ZTS,.1))[0
QUIT
+3 IF "BCDEFIL"'[$PIECE(^%ZTSK(ZTS,.1),U)
QUIT
+4 SET XUTMT=ZTS
SET XUTMT(0)="L"
DO ^XUTMT
+5 IF '$DATA(ZTSK("A"))
IF '$DATA(ZTSK("IO"))
IF '$DATA(ZTSK("JOB"))
IF '$DATA(ZTSK("LINK"))
IF '$DATA(ZTSK("TASK"))
DO SORT(+$PIECE(ZTSK(0),U,6),ZTS)
+6 QUIT
End DoDot:1
+7 WRITE "Finished!",!
+8 ;
N2 ;
+1 IF $ORDER(^TMP($JOB,0))=""
GOTO N3
+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
Begin DoDot:2
+7 DO PRINT
End DoDot:2
IF X
QUIT
+8 QUIT
End DoDot:1
IF X
QUIT
+9 IF X
KILL ^TMP($JOB)
QUIT
+10 ;
N3 IF 'ZTC
WRITE !!,"No tasks failed to run to completion."
+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 (ZTSK'>0)!(ZTDTH'>0)
QUIT
+2 IF ZTDTH[","
SET ZTDTH=$$H3^%ZTM(ZTDTH)
+3 SET ^TMP($JOB,ZTDTH,ZTSK)=""
+4 QUIT