XUTMDQ ;SEA/RDS - TaskMan: Option, XUTMDQ, Part 1 (Single) ;11/30/94 12:04 [ 04/02/2003 8:29 AM ]
;;8.0;KERNEL;**1002,1003,1004,1005,1007**;APR 1, 2003
;;8.0;KERNEL;;Jul 10, 1995
;
ENV ;Establish Routine Environment
N DDH,DIR,X,Y,ZTENV,ZTKEY,ZTNAME,ZTSK,XUTMUCI
D ENV^XUTMUTL Q:'$D(ZTENV)
;
SELECT ;Prompt User To Select Task Or Tasks To Unschedule
W !
S XUTMT(0)="AL" D ^XUTMT
I 'ZTSK K ^TMP($J,"XUTMT") Q
I ZTSK["-"!(ZTSK[",") D ^XUTMDQ1 Q:$D(DTOUT) G SELECT
S XUTMT=ZTSK,XUTMT(0)="R3" D ^XUTMT
;
STATUS ;Report On Status Of Task And Whether User May Unschedule It
I $D(ZTSK(.11))#2,ZTSK(.11)="UNDEFINED",$O(ZTSK(.3))="" W !!?5,"That task is not defined." G SELECT
I $D(ZTSK(.11))#2,ZTSK(.11)="UNDEFINED",$O(ZTSK(.3))="TASK",$O(ZTSK("TASK"))="" W !!?5,"That task is running and has no record." G SELECT
I $D(ZTSK(.11))#2,ZTSK(.11)="UNDEFINED" W !!?5,"That task is scheduled but has no record." G CONFIRM:ZTKEY G SELECT
;
S5 I $D(ZTSK(.11))#2,$O(ZTSK(.3))="" W !!?5,"That task's record is incomplete." G SELECT
I $D(ZTSK(.11))#2,$O(ZTSK(.3))="TASK",$O(ZTSK("TASK"))="" W !!?5,"That task is running and its record is incomplete." G SELECT
I $D(ZTSK(.11))#2 W !!?5,"That task is scheduled but its record is incomplete." G CONFIRM:ZTKEY G SELECT
;
S9 I $O(ZTSK(.3))="" W !!?5,"That task is not scheduled." G SELECT
I $O(ZTSK(.3))="TASK",$O(ZTSK("TASK"))="" W !!?5,"That task is running." G SELECT
I 'ZTKEY,$S($P(ZTSK(0),U,11)_","_$P(ZTSK(0),U,12)=XUTMUCI:DUZ'=$P(ZTSK(0),U,3),1:ZTNAME'=$P(ZTSK(0),U,10)) W !!?5,"You may only unschedule your own tasks." G SELECT
;
CONFIRM ;Prompt User To Confirm Unscheduling
I $S($D(ZTSK(.11))[0:1,1:ZTSK(.11)'="UNDEFINED") W ! D EN^XUTMTP(ZTSK)
W !
K DIR
S DIR(0)="Y"
S DIR("A")="Are you sure you want to unschedule this task"
S DIR("B")="NO"
S DIR("?")=" Answer YES to unschedule the task."
D ^DIR
I 'Y W !!?5,"NOT unscheduled!"
I $D(DTOUT) W $C(7) Q
I 'Y G SELECT
;
UNSCHED ;Unschedule Task
I $D(ZTSK(0))#2,ZTSK(0)["ZTSK^XQ1",$P(ZTSK(0),U,11)_","_$P(ZTSK(0),U,12)=XUTMUCI,$P(ZTSK(0),U,8)]"" D
. F DA=0:0 S DA=$O(^DIC(19.2,DA)) Q:DA'>0 I $G(^DIC(19.2,DA,1))=ZTSK D
. . N DIE S DIE="^DIC(19.2,",DR="1///@" D ^DIE Q
. Q
S XUTMT=ZTSK,XUTMT(0)="U" D ^XUTMT
W !!?5,"Unscheduled!"
G SELECT
;
XUTMDQ ;SEA/RDS - TaskMan: Option, XUTMDQ, Part 1 (Single) ;11/30/94 12:04 [ 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 ;
ENV ;Establish Routine Environment
+1 NEW DDH,DIR,X,Y,ZTENV,ZTKEY,ZTNAME,ZTSK,XUTMUCI
+2 DO ENV^XUTMUTL
IF '$DATA(ZTENV)
QUIT
+3 ;
SELECT ;Prompt User To Select Task Or Tasks To Unschedule
+1 WRITE !
+2 SET XUTMT(0)="AL"
DO ^XUTMT
+3 IF 'ZTSK
KILL ^TMP($JOB,"XUTMT")
QUIT
+4 IF ZTSK["-"!(ZTSK[",")
DO ^XUTMDQ1
IF $DATA(DTOUT)
QUIT
GOTO SELECT
+5 SET XUTMT=ZTSK
SET XUTMT(0)="R3"
DO ^XUTMT
+6 ;
STATUS ;Report On Status Of Task And Whether User May Unschedule It
+1 IF $DATA(ZTSK(.11))#2
IF ZTSK(.11)="UNDEFINED"
IF $ORDER(ZTSK(.3))=""
WRITE !!?5,"That task is not defined."
GOTO SELECT
+2 IF $DATA(ZTSK(.11))#2
IF ZTSK(.11)="UNDEFINED"
IF $ORDER(ZTSK(.3))="TASK"
IF $ORDER(ZTSK("TASK"))=""
WRITE !!?5,"That task is running and has no record."
GOTO SELECT
+3 IF $DATA(ZTSK(.11))#2
IF ZTSK(.11)="UNDEFINED"
WRITE !!?5,"That task is scheduled but has no record."
IF ZTKEY
GOTO CONFIRM
GOTO SELECT
+4 ;
S5 IF $DATA(ZTSK(.11))#2
IF $ORDER(ZTSK(.3))=""
WRITE !!?5,"That task's record is incomplete."
GOTO SELECT
+1 IF $DATA(ZTSK(.11))#2
IF $ORDER(ZTSK(.3))="TASK"
IF $ORDER(ZTSK("TASK"))=""
WRITE !!?5,"That task is running and its record is incomplete."
GOTO SELECT
+2 IF $DATA(ZTSK(.11))#2
WRITE !!?5,"That task is scheduled but its record is incomplete."
IF ZTKEY
GOTO CONFIRM
GOTO SELECT
+3 ;
S9 IF $ORDER(ZTSK(.3))=""
WRITE !!?5,"That task is not scheduled."
GOTO SELECT
+1 IF $ORDER(ZTSK(.3))="TASK"
IF $ORDER(ZTSK("TASK"))=""
WRITE !!?5,"That task is running."
GOTO SELECT
+2 IF 'ZTKEY
IF $SELECT($PIECE(ZTSK(0),U,11)_","_$PIECE(ZTSK(0),U,12)=XUTMUCI:DUZ'=$PIECE(ZTSK(0),U,3),1:ZTNAME'=$PIECE(ZTSK(0),U,10))
WRITE !!?5,"You may only unschedule your own tasks."
GOTO SELECT
+3 ;
CONFIRM ;Prompt User To Confirm Unscheduling
+1 IF $SELECT($DATA(ZTSK(.11))[0:1,1:ZTSK(.11)'="UNDEFINED")
WRITE !
DO EN^XUTMTP(ZTSK)
+2 WRITE !
+3 KILL DIR
+4 SET DIR(0)="Y"
+5 SET DIR("A")="Are you sure you want to unschedule this task"
+6 SET DIR("B")="NO"
+7 SET DIR("?")=" Answer YES to unschedule the task."
+8 DO ^DIR
+9 IF 'Y
WRITE !!?5,"NOT unscheduled!"
+10 IF $DATA(DTOUT)
WRITE $CHAR(7)
QUIT
+11 IF 'Y
GOTO SELECT
+12 ;
UNSCHED ;Unschedule Task
+1 IF $DATA(ZTSK(0))#2
IF ZTSK(0)["ZTSK^XQ1"
IF $PIECE(ZTSK(0),U,11)_","_$PIECE(ZTSK(0),U,12)=XUTMUCI
IF $PIECE(ZTSK(0),U,8)]""
Begin DoDot:1
+2 FOR DA=0:0
SET DA=$ORDER(^DIC(19.2,DA))
IF DA'>0
QUIT
IF $GET(^DIC(19.2,DA,1))=ZTSK
Begin DoDot:2
+3 NEW DIE
SET DIE="^DIC(19.2,"
SET DR="1///@"
DO ^DIE
QUIT
End DoDot:2
+4 QUIT
End DoDot:1
+5 SET XUTMT=ZTSK
SET XUTMT(0)="U"
DO ^XUTMT
+6 WRITE !!?5,"Unscheduled!"
+7 GOTO SELECT
+8 ;