1 | XUTMRJD ;SEA/RDS - TaskMan: Option, XURESJOB exit action ;08/07/97 15:01
|
---|
2 | ;;8.0;KERNEL;**49,67**;Jul 10, 1995
|
---|
3 | MAIN ;
|
---|
4 | ;Main module of XURESJOB exit action
|
---|
5 | I '$O(^%ZTSCH("TASK",0)) Q
|
---|
6 | N ZTCOUNT,ZTENV,ZTKEY,ZTNAME,ZTPLURAL,ZTSK,ZTOOPS,ZTOUT,XUTMUCI
|
---|
7 | S (ZTOOPS,ZTOUT)=0
|
---|
8 | K ^TMP($J,"XUTMRJD")
|
---|
9 | D ENV^XUTMUTL Q:'$D(ZTENV)
|
---|
10 | D EXPLAIN
|
---|
11 | D PROMPT1 Q:ZTOUT
|
---|
12 | M2 F D I ZTOUT Q
|
---|
13 | .D PROMPT2 I ZTOUT Q
|
---|
14 | .D PROMPT3 Q:ZTOUT
|
---|
15 | .D:'ZTOOPS DISPLAY I ZTOUT Q
|
---|
16 | .D PROMPT4 I ZTOOPS!ZTOUT Q
|
---|
17 | .D REMOVE
|
---|
18 | .Q
|
---|
19 | K ^TMP($J,"XUTMRJD")
|
---|
20 | Q
|
---|
21 | EXPLAIN ;
|
---|
22 | ;MAIN--explain purpose of this exit action
|
---|
23 | W !!,"If you forcibly exited any processes, some of them may have"
|
---|
24 | W !,"been TaskMan tasks. If so, TaskMan still believes the tasks"
|
---|
25 | W !,"are running. You can correct this problem by telling TaskMan"
|
---|
26 | W !,"which tasks you forcibly exited. TaskMan will then remove those"
|
---|
27 | W !,"tasks from its list of running tasks.",!
|
---|
28 | Q
|
---|
29 | PROMPT1 ;
|
---|
30 | ;MAIN--ask whether system manager forcibly exited any tasks
|
---|
31 | N DIR,DIRUT,DTOUT,DUOUT,X,Y
|
---|
32 | S DIR(0)="Y",DIR("A")="Did you forcibly exit any tasks",DIR("B")="Yes"
|
---|
33 | S DIR("?")="^D HELP1A^XUTMRJD1",DIR("??")="^D HELP1B^XUTMRJD1"
|
---|
34 | W ! D ^DIR
|
---|
35 | I $D(DTOUT) W " ** TIME-OUT **",$C(7)
|
---|
36 | I $D(DUOUT) W " ** ^-ESCAPE **"
|
---|
37 | I $D(DIRUT) S ZTOUT=1 Q
|
---|
38 | S ZTOUT='Y
|
---|
39 | Q
|
---|
40 | PROMPT2 ;
|
---|
41 | ;MAIN--ask system manager to select tasks to remove from Task List
|
---|
42 | N DIR,DIRUT,DTOUT,DUOUT,X,Y,XUTMT S ZTSK="" K ^TMP($J,"XUTMT")
|
---|
43 | F D Q:ZTSK!ZTOUT
|
---|
44 | .W ! S XUTMT(0)="AL"
|
---|
45 | .S XUTMT("A")="Which tasks did you forcibly exit (?T for list): "
|
---|
46 | .S XUTMT("S1")="D SCREEN2A^XUTMRJD1",XUTMT("S2")="D SCREEN2B^XUTMRJD1"
|
---|
47 | .S XUTMT("?")="^D HELP2A^XUTMRJD1",XUTMT("??")="^D HELP2B^XUTMRJD1"
|
---|
48 | .D ^XUTMT
|
---|
49 | P21 .;
|
---|
50 | .I ZTSK="?SYSTEM STATUS" X ^%ZOSF("SS") Q
|
---|
51 | .I ZTSK="?TASK LIST" D Q
|
---|
52 | ..K XUTMT
|
---|
53 | ..S XUTMT(0)="R4"
|
---|
54 | ..S XUTMT("NODE")="^%ZTSCH(""TASK"","
|
---|
55 | ..S XUTMT("NONE")="There are no running tasks listed"
|
---|
56 | ..W ! D ^XUTMT
|
---|
57 | ..Q
|
---|
58 | .I 'ZTSK S ZTOUT=1 W !!?5,"No tasks selected.",! Q
|
---|
59 | .Q
|
---|
60 | K ^TMP($J,"XUTMT")
|
---|
61 | Q
|
---|
62 | PROMPT3 ;
|
---|
63 | ;MAIN--ask system manager whether to display the selected tasks
|
---|
64 | N DIR,DIRUT,DTOUT,DUOUT,X,Y
|
---|
65 | S ZTCOUNT=^TMP($J,"XUTMRJD")
|
---|
66 | S ZTPLURAL="" I ZTCOUNT>1 S ZTPLURAL="s"
|
---|
67 | W !!?5,"You have selected ",ZTCOUNT," task",ZTPLURAL," listed as running."
|
---|
68 | W !
|
---|
69 | P3 ;
|
---|
70 | S DIR(0)="Y",DIR("A")="Do you want to see the task"_ZTPLURAL_" you have selected",DIR("B")="Yes"
|
---|
71 | S DIR("?")="^D HELP3A^XUTMRJD1",DIR("??")="^D HELP3B^XUTMRJD1"
|
---|
72 | D ^DIR
|
---|
73 | I $D(DTOUT) W " ** TIME-OUT **",$C(7)
|
---|
74 | I $D(DUOUT) W " ** ^-ESCAPE **"
|
---|
75 | I $D(DIRUT) S ZTOUT=1 Q
|
---|
76 | I 'Y S ZTOOPS=1
|
---|
77 | Q
|
---|
78 | DISPLAY ;
|
---|
79 | ;MAIN--display the selected tasks
|
---|
80 | N XUTMT,ZTSK
|
---|
81 | S XUTMT(0)="R4"
|
---|
82 | S XUTMT("NODE")="^TMP($J,""XUTMRJD"","
|
---|
83 | S XUTMT("NONE")="There is an error in this program."
|
---|
84 | W ! D ^XUTMT
|
---|
85 | Q
|
---|
86 | PROMPT4 ;
|
---|
87 | ;MAIN--ask system manager to confirm choice of tasks
|
---|
88 | N DIR,DIRUT,DTOUT,DUOUT,X,Y
|
---|
89 | W ! S DIR(0)="Y",DIR("A")="Are you sure you want to remove"
|
---|
90 | S DIR("A")=DIR("A")_$S(ZTCOUNT=1:" this task",1:" these tasks")_" from the list of running tasks"
|
---|
91 | P41 ;
|
---|
92 | S DIR("B")="No",DIR("?")="^D HELP4A^XUTMRJD1",DIR("??")="^D HELP4B^XUTMRJD1"
|
---|
93 | D ^DIR
|
---|
94 | I $D(DTOUT) W " ** TIME-OUT **",$C(7)
|
---|
95 | I $D(DUOUT) W " ** ^-ESCAPE **"
|
---|
96 | I $D(DIRUT) S ZTOUT=1 Q
|
---|
97 | S ZTOOPS='Y I Y Q
|
---|
98 | W !!?5,"The selected task",ZTPLURAL," will remain listed as running.",!
|
---|
99 | Q
|
---|
100 | REMOVE ;
|
---|
101 | ;MAIN--remove selected tasks from Task List
|
---|
102 | N ZTSK
|
---|
103 | W !!,"Removing selected task",ZTPLURAL,"..."
|
---|
104 | ;L +^%ZTSCH("TASK") removed patch #67
|
---|
105 | S ZTSK=0 F S ZTSK=$O(^TMP($J,"XUTMRJD",ZTSK)) Q:'ZTSK D
|
---|
106 | .L +^%ZTSCH("TASK",ZTSK):0 I '$T D Q
|
---|
107 | ..W !!,"Task is still running, kill job first"
|
---|
108 | ..W !,"Task "_ZTSK_" will not be removed, continuing..."
|
---|
109 | ..Q
|
---|
110 | .L -^%ZTSCH("TASK",ZTSK)
|
---|
111 | .K ^%ZTSCH("TASK",ZTSK)
|
---|
112 | .W !?5,"...",ZTSK," removed."
|
---|
113 | ;L -^%ZTSCH("TASK") removed patch #67
|
---|
114 | W !?5,"...finished!"
|
---|
115 | Q
|
---|
116 | ASK ;Call from the option
|
---|
117 | I '$O(^%ZTSCH("TASK",0)) Q
|
---|
118 | N ZTCOUNT,ZTENV,ZTKEY,ZTNAME,ZTPLURAL,ZTSK,ZTOOPS,ZTOUT,XUTMUCI
|
---|
119 | S (ZTOOPS,ZTOUT)=0
|
---|
120 | K ^TMP($J,"XUTMRJD")
|
---|
121 | D ENV^XUTMUTL Q:'$D(ZTENV)
|
---|
122 | W !,"This will allow you to remove entries from TaskMans list of",!,"running tasks that you believe are not running."
|
---|
123 | W !,"The questions will be asked assuming you have just killed a task"
|
---|
124 | G M2
|
---|