XUTMRJD ;SEA/RDS - TaskMan: Option, XURESJOB exit action ;08/07/97 15:01 [ 04/02/2003 8:29 AM ]
;;8.0;KERNEL;**1002,1003,1004,1005,1007**;APR 1, 2003
;;8.0;KERNEL;**49,67**;Jul 10, 1995
MAIN ;
;Main module of XURESJOB exit action
I '$O(^%ZTSCH("TASK",0)) Q
N ZTCOUNT,ZTENV,ZTKEY,ZTNAME,ZTPLURAL,ZTSK,ZTOOPS,ZTOUT,XUTMUCI
S (ZTOOPS,ZTOUT)=0
K ^TMP($J,"XUTMRJD")
D ENV^XUTMUTL Q:'$D(ZTENV)
D EXPLAIN
D PROMPT1 Q:ZTOUT
M2 F D I ZTOUT Q
.D PROMPT2 I ZTOUT Q
.D PROMPT3 Q:ZTOUT
.D:'ZTOOPS DISPLAY I ZTOUT Q
.D PROMPT4 I ZTOOPS!ZTOUT Q
.D REMOVE
.Q
K ^TMP($J,"XUTMRJD")
Q
EXPLAIN ;
;MAIN--explain purpose of this exit action
W !!,"If you forcibly exited any processes, some of them may have"
W !,"been TaskMan tasks. If so, TaskMan still believes the tasks"
W !,"are running. You can correct this problem by telling TaskMan"
W !,"which tasks you forcibly exited. TaskMan will then remove those"
W !,"tasks from its list of running tasks.",!
Q
PROMPT1 ;
;MAIN--ask whether system manager forcibly exited any tasks
N DIR,DIRUT,DTOUT,DUOUT,X,Y
S DIR(0)="Y",DIR("A")="Did you forcibly exit any tasks",DIR("B")="Yes"
S DIR("?")="^D HELP1A^XUTMRJD1",DIR("??")="^D HELP1B^XUTMRJD1"
W ! D ^DIR
I $D(DTOUT) W " ** TIME-OUT **",$C(7)
I $D(DUOUT) W " ** ^-ESCAPE **"
I $D(DIRUT) S ZTOUT=1 Q
S ZTOUT='Y
Q
PROMPT2 ;
;MAIN--ask system manager to select tasks to remove from Task List
N DIR,DIRUT,DTOUT,DUOUT,X,Y,XUTMT S ZTSK="" K ^TMP($J,"XUTMT")
F D Q:ZTSK!ZTOUT
.W ! S XUTMT(0)="AL"
.S XUTMT("A")="Which tasks did you forcibly exit (?T for list): "
.S XUTMT("S1")="D SCREEN2A^XUTMRJD1",XUTMT("S2")="D SCREEN2B^XUTMRJD1"
.S XUTMT("?")="^D HELP2A^XUTMRJD1",XUTMT("??")="^D HELP2B^XUTMRJD1"
.D ^XUTMT
P21 .;
.I ZTSK="?SYSTEM STATUS" X ^%ZOSF("SS") Q
.I ZTSK="?TASK LIST" D Q
..K XUTMT
..S XUTMT(0)="R4"
..S XUTMT("NODE")="^%ZTSCH(""TASK"","
..S XUTMT("NONE")="There are no running tasks listed"
..W ! D ^XUTMT
..Q
.I 'ZTSK S ZTOUT=1 W !!?5,"No tasks selected.",! Q
.Q
K ^TMP($J,"XUTMT")
Q
PROMPT3 ;
;MAIN--ask system manager whether to display the selected tasks
N DIR,DIRUT,DTOUT,DUOUT,X,Y
S ZTCOUNT=^TMP($J,"XUTMRJD")
S ZTPLURAL="" I ZTCOUNT>1 S ZTPLURAL="s"
W !!?5,"You have selected ",ZTCOUNT," task",ZTPLURAL," listed as running."
W !
P3 ;
S DIR(0)="Y",DIR("A")="Do you want to see the task"_ZTPLURAL_" you have selected",DIR("B")="Yes"
S DIR("?")="^D HELP3A^XUTMRJD1",DIR("??")="^D HELP3B^XUTMRJD1"
D ^DIR
I $D(DTOUT) W " ** TIME-OUT **",$C(7)
I $D(DUOUT) W " ** ^-ESCAPE **"
I $D(DIRUT) S ZTOUT=1 Q
I 'Y S ZTOOPS=1
Q
DISPLAY ;
;MAIN--display the selected tasks
N XUTMT,ZTSK
S XUTMT(0)="R4"
S XUTMT("NODE")="^TMP($J,""XUTMRJD"","
S XUTMT("NONE")="There is an error in this program."
W ! D ^XUTMT
Q
PROMPT4 ;
;MAIN--ask system manager to confirm choice of tasks
N DIR,DIRUT,DTOUT,DUOUT,X,Y
W ! S DIR(0)="Y",DIR("A")="Are you sure you want to remove"
S DIR("A")=DIR("A")_$S(ZTCOUNT=1:" this task",1:" these tasks")_" from the list of running tasks"
P41 ;
S DIR("B")="No",DIR("?")="^D HELP4A^XUTMRJD1",DIR("??")="^D HELP4B^XUTMRJD1"
D ^DIR
I $D(DTOUT) W " ** TIME-OUT **",$C(7)
I $D(DUOUT) W " ** ^-ESCAPE **"
I $D(DIRUT) S ZTOUT=1 Q
S ZTOOPS='Y I Y Q
W !!?5,"The selected task",ZTPLURAL," will remain listed as running.",!
Q
REMOVE ;
;MAIN--remove selected tasks from Task List
N ZTSK
W !!,"Removing selected task",ZTPLURAL,"..."
;L +^%ZTSCH("TASK") removed patch #67
S ZTSK=0 F S ZTSK=$O(^TMP($J,"XUTMRJD",ZTSK)) Q:'ZTSK D
.L +^%ZTSCH("TASK",ZTSK):0 I '$T D Q
..W !!,"Task is still running, kill job first"
..W !,"Task "_ZTSK_" will not be removed, continuing..."
..Q
.L -^%ZTSCH("TASK",ZTSK)
.K ^%ZTSCH("TASK",ZTSK)
.W !?5,"...",ZTSK," removed."
;L -^%ZTSCH("TASK") removed patch #67
W !?5,"...finished!"
Q
ASK ;Call from the option
I '$O(^%ZTSCH("TASK",0)) Q
N ZTCOUNT,ZTENV,ZTKEY,ZTNAME,ZTPLURAL,ZTSK,ZTOOPS,ZTOUT,XUTMUCI
S (ZTOOPS,ZTOUT)=0
K ^TMP($J,"XUTMRJD")
D ENV^XUTMUTL Q:'$D(ZTENV)
W !,"This will allow you to remove entries from TaskMans list of",!,"running tasks that you believe are not running."
W !,"The questions will be asked assuming you have just killed a task"
G M2
XUTMRJD ;SEA/RDS - TaskMan: Option, XURESJOB exit action ;08/07/97 15:01 [ 04/02/2003 8:29 AM ]
+1 ;;8.0;KERNEL;**1002,1003,1004,1005,1007**;APR 1, 2003
+2 ;;8.0;KERNEL;**49,67**;Jul 10, 1995
MAIN ;
+1 ;Main module of XURESJOB exit action
+2 IF '$ORDER(^%ZTSCH("TASK",0))
QUIT
+3 NEW ZTCOUNT,ZTENV,ZTKEY,ZTNAME,ZTPLURAL,ZTSK,ZTOOPS,ZTOUT,XUTMUCI
+4 SET (ZTOOPS,ZTOUT)=0
+5 KILL ^TMP($JOB,"XUTMRJD")
+6 DO ENV^XUTMUTL
IF '$DATA(ZTENV)
QUIT
+7 DO EXPLAIN
+8 DO PROMPT1
IF ZTOUT
QUIT
M2 FOR
Begin DoDot:1
+1 DO PROMPT2
IF ZTOUT
QUIT
+2 DO PROMPT3
IF ZTOUT
QUIT
+3 IF 'ZTOOPS
DO DISPLAY
IF ZTOUT
QUIT
+4 DO PROMPT4
IF ZTOOPS!ZTOUT
QUIT
+5 DO REMOVE
+6 QUIT
End DoDot:1
IF ZTOUT
QUIT
+7 KILL ^TMP($JOB,"XUTMRJD")
+8 QUIT
EXPLAIN ;
+1 ;MAIN--explain purpose of this exit action
+2 WRITE !!,"If you forcibly exited any processes, some of them may have"
+3 WRITE !,"been TaskMan tasks. If so, TaskMan still believes the tasks"
+4 WRITE !,"are running. You can correct this problem by telling TaskMan"
+5 WRITE !,"which tasks you forcibly exited. TaskMan will then remove those"
+6 WRITE !,"tasks from its list of running tasks.",!
+7 QUIT
PROMPT1 ;
+1 ;MAIN--ask whether system manager forcibly exited any tasks
+2 NEW DIR,DIRUT,DTOUT,DUOUT,X,Y
+3 SET DIR(0)="Y"
SET DIR("A")="Did you forcibly exit any tasks"
SET DIR("B")="Yes"
+4 SET DIR("?")="^D HELP1A^XUTMRJD1"
SET DIR("??")="^D HELP1B^XUTMRJD1"
+5 WRITE !
DO ^DIR
+6 IF $DATA(DTOUT)
WRITE " ** TIME-OUT **",$CHAR(7)
+7 IF $DATA(DUOUT)
WRITE " ** ^-ESCAPE **"
+8 IF $DATA(DIRUT)
SET ZTOUT=1
QUIT
+9 SET ZTOUT='Y
+10 QUIT
PROMPT2 ;
+1 ;MAIN--ask system manager to select tasks to remove from Task List
+2 NEW DIR,DIRUT,DTOUT,DUOUT,X,Y,XUTMT
SET ZTSK=""
KILL ^TMP($JOB,"XUTMT")
+3 FOR
Begin DoDot:1
+4 WRITE !
SET XUTMT(0)="AL"
+5 SET XUTMT("A")="Which tasks did you forcibly exit (?T for list): "
+6 SET XUTMT("S1")="D SCREEN2A^XUTMRJD1"
SET XUTMT("S2")="D SCREEN2B^XUTMRJD1"
+7 SET XUTMT("?")="^D HELP2A^XUTMRJD1"
SET XUTMT("??")="^D HELP2B^XUTMRJD1"
+8 DO ^XUTMT
P21 ;
+1 IF ZTSK="?SYSTEM STATUS"
XECUTE ^%ZOSF("SS")
QUIT
+2 IF ZTSK="?TASK LIST"
Begin DoDot:2
+3 KILL XUTMT
+4 SET XUTMT(0)="R4"
+5 SET XUTMT("NODE")="^%ZTSCH(""TASK"","
+6 SET XUTMT("NONE")="There are no running tasks listed"
+7 WRITE !
DO ^XUTMT
+8 QUIT
End DoDot:2
QUIT
+9 IF 'ZTSK
SET ZTOUT=1
WRITE !!?5,"No tasks selected.",!
QUIT
+10 QUIT
End DoDot:1
IF ZTSK!ZTOUT
QUIT
+11 KILL ^TMP($JOB,"XUTMT")
+12 QUIT
PROMPT3 ;
+1 ;MAIN--ask system manager whether to display the selected tasks
+2 NEW DIR,DIRUT,DTOUT,DUOUT,X,Y
+3 SET ZTCOUNT=^TMP($JOB,"XUTMRJD")
+4 SET ZTPLURAL=""
IF ZTCOUNT>1
SET ZTPLURAL="s"
+5 WRITE !!?5,"You have selected ",ZTCOUNT," task",ZTPLURAL," listed as running."
+6 WRITE !
P3 ;
+1 SET DIR(0)="Y"
SET DIR("A")="Do you want to see the task"_ZTPLURAL_" you have selected"
SET DIR("B")="Yes"
+2 SET DIR("?")="^D HELP3A^XUTMRJD1"
SET DIR("??")="^D HELP3B^XUTMRJD1"
+3 DO ^DIR
+4 IF $DATA(DTOUT)
WRITE " ** TIME-OUT **",$CHAR(7)
+5 IF $DATA(DUOUT)
WRITE " ** ^-ESCAPE **"
+6 IF $DATA(DIRUT)
SET ZTOUT=1
QUIT
+7 IF 'Y
SET ZTOOPS=1
+8 QUIT
DISPLAY ;
+1 ;MAIN--display the selected tasks
+2 NEW XUTMT,ZTSK
+3 SET XUTMT(0)="R4"
+4 SET XUTMT("NODE")="^TMP($J,""XUTMRJD"","
+5 SET XUTMT("NONE")="There is an error in this program."
+6 WRITE !
DO ^XUTMT
+7 QUIT
PROMPT4 ;
+1 ;MAIN--ask system manager to confirm choice of tasks
+2 NEW DIR,DIRUT,DTOUT,DUOUT,X,Y
+3 WRITE !
SET DIR(0)="Y"
SET DIR("A")="Are you sure you want to remove"
+4 SET DIR("A")=DIR("A")_$SELECT(ZTCOUNT=1:" this task",1:" these tasks")_" from the list of running tasks"
P41 ;
+1 SET DIR("B")="No"
SET DIR("?")="^D HELP4A^XUTMRJD1"
SET DIR("??")="^D HELP4B^XUTMRJD1"
+2 DO ^DIR
+3 IF $DATA(DTOUT)
WRITE " ** TIME-OUT **",$CHAR(7)
+4 IF $DATA(DUOUT)
WRITE " ** ^-ESCAPE **"
+5 IF $DATA(DIRUT)
SET ZTOUT=1
QUIT
+6 SET ZTOOPS='Y
IF Y
QUIT
+7 WRITE !!?5,"The selected task",ZTPLURAL," will remain listed as running.",!
+8 QUIT
REMOVE ;
+1 ;MAIN--remove selected tasks from Task List
+2 NEW ZTSK
+3 WRITE !!,"Removing selected task",ZTPLURAL,"..."
+4 ;L +^%ZTSCH("TASK") removed patch #67
+5 SET ZTSK=0
FOR
SET ZTSK=$ORDER(^TMP($JOB,"XUTMRJD",ZTSK))
IF 'ZTSK
QUIT
Begin DoDot:1
+6 LOCK +^%ZTSCH("TASK",ZTSK):0
IF '$TEST
Begin DoDot:2
+7 WRITE !!,"Task is still running, kill job first"
+8 WRITE !,"Task "_ZTSK_" will not be removed, continuing..."
+9 QUIT
End DoDot:2
QUIT
+10 LOCK -^%ZTSCH("TASK",ZTSK)
+11 KILL ^%ZTSCH("TASK",ZTSK)
+12 WRITE !?5,"...",ZTSK," removed."
End DoDot:1
+13 ;L -^%ZTSCH("TASK") removed patch #67
+14 WRITE !?5,"...finished!"
+15 QUIT
ASK ;Call from the option
+1 IF '$ORDER(^%ZTSCH("TASK",0))
QUIT
+2 NEW ZTCOUNT,ZTENV,ZTKEY,ZTNAME,ZTPLURAL,ZTSK,ZTOOPS,ZTOUT,XUTMUCI
+3 SET (ZTOOPS,ZTOUT)=0
+4 KILL ^TMP($JOB,"XUTMRJD")
+5 DO ENV^XUTMUTL
IF '$DATA(ZTENV)
QUIT
+6 WRITE !,"This will allow you to remove entries from TaskMans list of",!,"running tasks that you believe are not running."
+7 WRITE !,"The questions will be asked assuming you have just killed a task"
+8 GOTO M2