Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: XUTMRJD

XUTMRJD.m

Go to the documentation of this file.
  1. 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
  1. ;;8.0;KERNEL;**49,67**;Jul 10, 1995
  1. MAIN ;
  1. ;Main module of XURESJOB exit action
  1. I '$O(^%ZTSCH("TASK",0)) Q
  1. N ZTCOUNT,ZTENV,ZTKEY,ZTNAME,ZTPLURAL,ZTSK,ZTOOPS,ZTOUT,XUTMUCI
  1. S (ZTOOPS,ZTOUT)=0
  1. K ^TMP($J,"XUTMRJD")
  1. D ENV^XUTMUTL Q:'$D(ZTENV)
  1. D EXPLAIN
  1. D PROMPT1 Q:ZTOUT
  1. M2 F D I ZTOUT Q
  1. .D PROMPT2 I ZTOUT Q
  1. .D PROMPT3 Q:ZTOUT
  1. .D:'ZTOOPS DISPLAY I ZTOUT Q
  1. .D PROMPT4 I ZTOOPS!ZTOUT Q
  1. .D REMOVE
  1. .Q
  1. K ^TMP($J,"XUTMRJD")
  1. Q
  1. EXPLAIN ;
  1. ;MAIN--explain purpose of this exit action
  1. W !!,"If you forcibly exited any processes, some of them may have"
  1. W !,"been TaskMan tasks. If so, TaskMan still believes the tasks"
  1. W !,"are running. You can correct this problem by telling TaskMan"
  1. W !,"which tasks you forcibly exited. TaskMan will then remove those"
  1. W !,"tasks from its list of running tasks.",!
  1. Q
  1. PROMPT1 ;
  1. ;MAIN--ask whether system manager forcibly exited any tasks
  1. N DIR,DIRUT,DTOUT,DUOUT,X,Y
  1. S DIR(0)="Y",DIR("A")="Did you forcibly exit any tasks",DIR("B")="Yes"
  1. S DIR("?")="^D HELP1A^XUTMRJD1",DIR("??")="^D HELP1B^XUTMRJD1"
  1. W ! D ^DIR
  1. I $D(DTOUT) W " ** TIME-OUT **",$C(7)
  1. I $D(DUOUT) W " ** ^-ESCAPE **"
  1. I $D(DIRUT) S ZTOUT=1 Q
  1. S ZTOUT='Y
  1. Q
  1. PROMPT2 ;
  1. ;MAIN--ask system manager to select tasks to remove from Task List
  1. N DIR,DIRUT,DTOUT,DUOUT,X,Y,XUTMT S ZTSK="" K ^TMP($J,"XUTMT")
  1. F D Q:ZTSK!ZTOUT
  1. .W ! S XUTMT(0)="AL"
  1. .S XUTMT("A")="Which tasks did you forcibly exit (?T for list): "
  1. .S XUTMT("S1")="D SCREEN2A^XUTMRJD1",XUTMT("S2")="D SCREEN2B^XUTMRJD1"
  1. .S XUTMT("?")="^D HELP2A^XUTMRJD1",XUTMT("??")="^D HELP2B^XUTMRJD1"
  1. .D ^XUTMT
  1. P21 .;
  1. .I ZTSK="?SYSTEM STATUS" X ^%ZOSF("SS") Q
  1. .I ZTSK="?TASK LIST" D Q
  1. ..K XUTMT
  1. ..S XUTMT(0)="R4"
  1. ..S XUTMT("NODE")="^%ZTSCH(""TASK"","
  1. ..S XUTMT("NONE")="There are no running tasks listed"
  1. ..W ! D ^XUTMT
  1. ..Q
  1. .I 'ZTSK S ZTOUT=1 W !!?5,"No tasks selected.",! Q
  1. .Q
  1. K ^TMP($J,"XUTMT")
  1. Q
  1. PROMPT3 ;
  1. ;MAIN--ask system manager whether to display the selected tasks
  1. N DIR,DIRUT,DTOUT,DUOUT,X,Y
  1. S ZTCOUNT=^TMP($J,"XUTMRJD")
  1. S ZTPLURAL="" I ZTCOUNT>1 S ZTPLURAL="s"
  1. W !!?5,"You have selected ",ZTCOUNT," task",ZTPLURAL," listed as running."
  1. W !
  1. P3 ;
  1. S DIR(0)="Y",DIR("A")="Do you want to see the task"_ZTPLURAL_" you have selected",DIR("B")="Yes"
  1. S DIR("?")="^D HELP3A^XUTMRJD1",DIR("??")="^D HELP3B^XUTMRJD1"
  1. D ^DIR
  1. I $D(DTOUT) W " ** TIME-OUT **",$C(7)
  1. I $D(DUOUT) W " ** ^-ESCAPE **"
  1. I $D(DIRUT) S ZTOUT=1 Q
  1. I 'Y S ZTOOPS=1
  1. Q
  1. DISPLAY ;
  1. ;MAIN--display the selected tasks
  1. N XUTMT,ZTSK
  1. S XUTMT(0)="R4"
  1. S XUTMT("NODE")="^TMP($J,""XUTMRJD"","
  1. S XUTMT("NONE")="There is an error in this program."
  1. W ! D ^XUTMT
  1. Q
  1. PROMPT4 ;
  1. ;MAIN--ask system manager to confirm choice of tasks
  1. N DIR,DIRUT,DTOUT,DUOUT,X,Y
  1. W ! S DIR(0)="Y",DIR("A")="Are you sure you want to remove"
  1. S DIR("A")=DIR("A")_$S(ZTCOUNT=1:" this task",1:" these tasks")_" from the list of running tasks"
  1. P41 ;
  1. S DIR("B")="No",DIR("?")="^D HELP4A^XUTMRJD1",DIR("??")="^D HELP4B^XUTMRJD1"
  1. D ^DIR
  1. I $D(DTOUT) W " ** TIME-OUT **",$C(7)
  1. I $D(DUOUT) W " ** ^-ESCAPE **"
  1. I $D(DIRUT) S ZTOUT=1 Q
  1. S ZTOOPS='Y I Y Q
  1. W !!?5,"The selected task",ZTPLURAL," will remain listed as running.",!
  1. Q
  1. REMOVE ;
  1. ;MAIN--remove selected tasks from Task List
  1. N ZTSK
  1. W !!,"Removing selected task",ZTPLURAL,"..."
  1. ;L +^%ZTSCH("TASK") removed patch #67
  1. S ZTSK=0 F S ZTSK=$O(^TMP($J,"XUTMRJD",ZTSK)) Q:'ZTSK D
  1. .L +^%ZTSCH("TASK",ZTSK):0 I '$T D Q
  1. ..W !!,"Task is still running, kill job first"
  1. ..W !,"Task "_ZTSK_" will not be removed, continuing..."
  1. ..Q
  1. .L -^%ZTSCH("TASK",ZTSK)
  1. .K ^%ZTSCH("TASK",ZTSK)
  1. .W !?5,"...",ZTSK," removed."
  1. ;L -^%ZTSCH("TASK") removed patch #67
  1. W !?5,"...finished!"
  1. Q
  1. ASK ;Call from the option
  1. I '$O(^%ZTSCH("TASK",0)) Q
  1. N ZTCOUNT,ZTENV,ZTKEY,ZTNAME,ZTPLURAL,ZTSK,ZTOOPS,ZTOUT,XUTMUCI
  1. S (ZTOOPS,ZTOUT)=0
  1. K ^TMP($J,"XUTMRJD")
  1. D ENV^XUTMUTL Q:'$D(ZTENV)
  1. W !,"This will allow you to remove entries from TaskMans list of",!,"running tasks that you believe are not running."
  1. W !,"The questions will be asked assuming you have just killed a task"
  1. G M2