XUTMQ ;SEA/RDS - TaskMan: Option, XUTMINQ, Show task lists ;07/24/2000 13:23
;;8.0;KERNEL;**20,136,169**;Jul 10, 1995
;
ENV ;Establish Routine Environment
N %,%ZTF,%ZTI,%ZTJ,%ZTL,%ZTR,DDH,DIR,DIRUT,DTOUT,DUOUT,X,Y,ZT,ZT1,ZTENV,ZTKEY,ZTNAME,XUTMUCI
D ENV^XUTMUTL Q:'$D(ZTENV)
I '+$O(^%ZTSK(0))&'$D(^%ZTSCH("TASK")) W !!,"The Task File is empty, and there are no tasks currently running." S DIR(0)="E" D ^DIR Q
;
SELECT ;Select listing (main loop)
F ZT=0:0 D FLAGS,SET,PROMPT,^DIR Q:$D(DIRUT) K DIR,DIRUT,DTOUT,DUOUT D BRANCH
I $D(DTOUT) W "*TIMEOUT*",$C(7)
K DIR,DIRUT,DTOUT,DUOUT,X,Y
Q
;
FLAGS ;Reset Taskman Files Status Flags
N X,Y
W @IOF S ZT1="",%ZTL=0 F S ZT1=$O(^%ZTSCH("LINK",ZT1)) Q:ZT1="" I $O(^%ZTSCH("LINK",ZT1,""))]"" S %ZTL=1 Q
S ZT1="",%ZTJ=0 F S ZT1=$O(^%ZTSCH("JOB",ZT1)) Q:ZT1="" I $O(^%ZTSCH("JOB",ZT1,0))]"" S %ZTJ=1 Q
S X="",%ZTI=0
F S X=$O(^%ZTSCH("IO",X)) Q:X="" I $D(^%ZTSCH("IO",X))>9 S %ZTI=1 Q
S %ZTF=+$O(^%ZTSCH(""))!%ZTI!%ZTL!%ZTJ,%ZTR=$D(^%ZTSCH("TASK"))
Q
;
SET ;Create set of choices for user
I ZTKEY S DIR(0)="A:All of one user's tasks.;O:One user's future tasks.;"
E S DIR(0)="A:All of your tasks.;Y:Your future tasks.;"
S DIR(0)="SAOM^"_DIR(0)_"E:Every task.;L:List of tasks.;U:Unsuccessful tasks." S:%ZTF DIR(0)=DIR(0)_";F:Future tasks."
S:%ZTI DIR(0)=DIR(0)_";T:Tasks waiting for devices.;W:Waiting list for a device." S:%ZTR DIR(0)=DIR(0)_";R:Running tasks."
S:%ZTL DIR(0)=DIR(0)_";C:Cross-cpu waiting lists."
Q
;
PROMPT ;Create prompt and help text
S DIR("A",1)=" List Tasks Option"
S DIR("A",2)=""
S DIR("A",3)=" All of one user's tasks."
S DIR("A",4)=" One user's future tasks."
S:'ZTKEY DIR("A",3)=" All your tasks."
S:'ZTKEY DIR("A",4)=" Your future tasks."
S DIR("A",5)=" Every task."
S DIR("A",6)=" List of tasks."
S DIR("A",7)=" Unsuccessful tasks."
S:%ZTF DIR("A",8)=" Future tasks."
S:%ZTI DIR("A",9)=" Tasks waiting for devices."
S:%ZTI DIR("A",10)=" Waiting list for a device."
S X=$S(%ZTI:11,%ZTF:9,1:8)
S:%ZTR DIR("A",X)=" Running tasks.",X=X+1
S:%ZTL DIR("A",X)=" Cross-cpu waiting lists.",X=X+1
S DIR("A",X)="",DIR("A")=" Select Type Of Listing: "
S DIR("?")="^D HELP^XUTMQH"
Q
;
BRANCH ;DO selected listing
N ZT
D @$S(Y="A":"ALL^XUTMQ0",Y="O"!(Y="Y"):"FUT^XUTMQ0",Y="E":"EVERY^XUTMQ1",Y="L":"LIST^XUTMQ1",Y="U":"NOT^XUTMQ1",Y="C":"LINK^XUTMQ2",Y="R":"RUN^XUTMQ2",Y="F":"FUT^XUTMQ2",Y="T":"IOQ^XUTMQ3",1:"IO1^XUTMQ3")
Q
LIST ;Print a list of tasks in ^TMP($J,n,m).
N XUTMT,XU1,XU2,IOCRT,XUDD,XUTSK,PG
D LSTPRE,HDR S XU1=0
F S XU1=$O(^TMP($J,XU1)),XU2=0 Q:XU1'>0 F S XU2=$O(^TMP($J,XU1,XU2)) Q:XU2'>0 D I $D(DIRUT) S (XU1,XU2)="A"
. I $Y+5'<IOSL D HDR Q:$D(DIRUT)
. W !,"-------------------------------------------------------------------------------"
. D EN^XUTMTP(XU2)
. Q
D:'$D(DIRUT)&IOCRT WAIT
Q
LSTPRE ;
S IOCRT=$E(IOST,1,2)["C-",XUDD=$$HTE^XLFDT($H,"1MP"),PG=0
Q
HDR I PG>0,IOCRT D WAIT Q:$D(DIRUT)
I (PG>0)!(IOCRT) W @IOF
S PG=PG+1
W "Task list ",XUDD,?70,"Page ",PG
Q
WAIT S DIR(0)="E" D ^DIR
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HXUTMQ 3436 printed Oct 16, 2024@18:14:16 Page 2
XUTMQ ;SEA/RDS - TaskMan: Option, XUTMINQ, Show task lists ;07/24/2000 13:23
+1 ;;8.0;KERNEL;**20,136,169**;Jul 10, 1995
+2 ;
ENV ;Establish Routine Environment
+1 NEW %,%ZTF,%ZTI,%ZTJ,%ZTL,%ZTR,DDH,DIR,DIRUT,DTOUT,DUOUT,X,Y,ZT,ZT1,ZTENV,ZTKEY,ZTNAME,XUTMUCI
+2 DO ENV^XUTMUTL
if '$DATA(ZTENV)
QUIT
+3 IF '+$ORDER(^%ZTSK(0))&'$DATA(^%ZTSCH("TASK"))
WRITE !!,"The Task File is empty, and there are no tasks currently running."
SET DIR(0)="E"
DO ^DIR
QUIT
+4 ;
SELECT ;Select listing (main loop)
+1 FOR ZT=0:0
DO FLAGS
DO SET
DO PROMPT
DO ^DIR
if $DATA(DIRUT)
QUIT
KILL DIR,DIRUT,DTOUT,DUOUT
DO BRANCH
+2 IF $DATA(DTOUT)
WRITE "*TIMEOUT*",$CHAR(7)
+3 KILL DIR,DIRUT,DTOUT,DUOUT,X,Y
+4 QUIT
+5 ;
FLAGS ;Reset Taskman Files Status Flags
+1 NEW X,Y
+2 WRITE @IOF
SET ZT1=""
SET %ZTL=0
FOR
SET ZT1=$ORDER(^%ZTSCH("LINK",ZT1))
if ZT1=""
QUIT
IF $ORDER(^%ZTSCH("LINK",ZT1,""))]""
SET %ZTL=1
QUIT
+3 SET ZT1=""
SET %ZTJ=0
FOR
SET ZT1=$ORDER(^%ZTSCH("JOB",ZT1))
if ZT1=""
QUIT
IF $ORDER(^%ZTSCH("JOB",ZT1,0))]""
SET %ZTJ=1
QUIT
+4 SET X=""
SET %ZTI=0
+5 FOR
SET X=$ORDER(^%ZTSCH("IO",X))
if X=""
QUIT
IF $DATA(^%ZTSCH("IO",X))>9
SET %ZTI=1
QUIT
+6 SET %ZTF=+$ORDER(^%ZTSCH(""))!%ZTI!%ZTL!%ZTJ
SET %ZTR=$DATA(^%ZTSCH("TASK"))
+7 QUIT
+8 ;
SET ;Create set of choices for user
+1 IF ZTKEY
SET DIR(0)="A:All of one user's tasks.;O:One user's future tasks.;"
+2 IF '$TEST
SET DIR(0)="A:All of your tasks.;Y:Your future tasks.;"
+3 SET DIR(0)="SAOM^"_DIR(0)_"E:Every task.;L:List of tasks.;U:Unsuccessful tasks."
if %ZTF
SET DIR(0)=DIR(0)_";F:Future tasks."
+4 if %ZTI
SET DIR(0)=DIR(0)_";T:Tasks waiting for devices.;W:Waiting list for a device."
if %ZTR
SET DIR(0)=DIR(0)_";R:Running tasks."
+5 if %ZTL
SET DIR(0)=DIR(0)_";C:Cross-cpu waiting lists."
+6 QUIT
+7 ;
PROMPT ;Create prompt and help text
+1 SET DIR("A",1)=" List Tasks Option"
+2 SET DIR("A",2)=""
+3 SET DIR("A",3)=" All of one user's tasks."
+4 SET DIR("A",4)=" One user's future tasks."
+5 if 'ZTKEY
SET DIR("A",3)=" All your tasks."
+6 if 'ZTKEY
SET DIR("A",4)=" Your future tasks."
+7 SET DIR("A",5)=" Every task."
+8 SET DIR("A",6)=" List of tasks."
+9 SET DIR("A",7)=" Unsuccessful tasks."
+10 if %ZTF
SET DIR("A",8)=" Future tasks."
+11 if %ZTI
SET DIR("A",9)=" Tasks waiting for devices."
+12 if %ZTI
SET DIR("A",10)=" Waiting list for a device."
+13 SET X=$SELECT(%ZTI:11,%ZTF:9,1:8)
+14 if %ZTR
SET DIR("A",X)=" Running tasks."
SET X=X+1
+15 if %ZTL
SET DIR("A",X)=" Cross-cpu waiting lists."
SET X=X+1
+16 SET DIR("A",X)=""
SET DIR("A")=" Select Type Of Listing: "
+17 SET DIR("?")="^D HELP^XUTMQH"
+18 QUIT
+19 ;
BRANCH ;DO selected listing
+1 NEW ZT
+2 DO @$SELECT(Y="A":"ALL^XUTMQ0",Y="O"!(Y="Y"):"FUT^XUTMQ0",Y="E":"EVERY^XUTMQ1",Y="L":"LIST^XUTMQ1",Y="U":"NOT^XUTMQ1",Y="C":"LINK^XUTMQ2",Y="R":"RUN^XUTMQ2",Y="F":"FUT^XUTMQ2",Y="T":"IOQ^XUTMQ3",1:"IO1^XUTMQ3")
+3 QUIT
LIST ;Print a list of tasks in ^TMP($J,n,m).
+1 NEW XUTMT,XU1,XU2,IOCRT,XUDD,XUTSK,PG
+2 DO LSTPRE
DO HDR
SET XU1=0
+3 FOR
SET XU1=$ORDER(^TMP($JOB,XU1))
SET XU2=0
if XU1'>0
QUIT
FOR
SET XU2=$ORDER(^TMP($JOB,XU1,XU2))
if XU2'>0
QUIT
Begin DoDot:1
+4 IF $Y+5'<IOSL
DO HDR
if $DATA(DIRUT)
QUIT
+5 WRITE !,"-------------------------------------------------------------------------------"
+6 DO EN^XUTMTP(XU2)
+7 QUIT
End DoDot:1
IF $DATA(DIRUT)
SET (XU1,XU2)="A"
+8 if '$DATA(DIRUT)&IOCRT
DO WAIT
+9 QUIT
LSTPRE ;
+1 SET IOCRT=$EXTRACT(IOST,1,2)["C-"
SET XUDD=$$HTE^XLFDT($HOROLOG,"1MP")
SET PG=0
+2 QUIT
HDR IF PG>0
IF IOCRT
DO WAIT
if $DATA(DIRUT)
QUIT
+1 IF (PG>0)!(IOCRT)
WRITE @IOF
+2 SET PG=PG+1
+3 WRITE "Task list ",XUDD,?70,"Page ",PG
+4 QUIT
WAIT SET DIR(0)="E"
DO ^DIR
+1 QUIT