source: WorldVistAEHR/trunk/r/PATCH_MANAGEMNT-AAQ/AAQPRKIL.m@ 949

Last change on this file since 949 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.2 KB
Line 
1AAQPRKIL ;FGO/PJP - Stop running Print jobs ;09/22/97 [8/28/01 10:38am]
2 ;;1.0;Local;;
3 ;
4 ; This routine will kill a process and remove an associated task
5 ; from the task list, %ZTSCH("TASK",). You will be prompted for a
6 ; print device and the routine will search all running jobs and
7 ; display the job tied to that Device.
8 S FOUND=0 W ! S DIC="^%ZIS(1,",DIC(0)="AEMQZ",DIC("A")="Enter Printer Name: " D ^DIC
9 I Y=-1 G EXIT
10 S PRINTER=$P(Y(0),"^",2)
11 W !!,"If a print job is actively printing, answer the LOGOUT",!,"question with YES to continue with the kill process."
12 W !!,"A print job stopped due to an Equinox port in XOFF state",!,"may resume printing after using LOGOUT to make the port available."
13ASKLO S %=1 W !!,"Have you checked the port status to see if a LOGOUT is needed" D YN^DICN S AAQLO=% I %=0 W !!,"Answer 'Y' to continue with killing the job.",!,"Answer 'N' to check the port status first." G ASKLO
14 I AAQLO=2 W !!,"Check the port, LOGOUT if needed, check port status for Accessed/Activity",!,"or us Examine Job to see if the job has resumed." R !!,"Press RETURN to continue:",DANS:15 W ! G EXIT
15 ;; Taken from %ZAUG ;at/jas; birmingham ocio/albany ocio ;PROGRAM TO LIST JOBS AND PIDS
16 S SW10=$V(0,-2,$ZU(40,0,1))\1024#2
17 S BASE=$V($ZU(40,2,47),-2,"S")
18 S MAXPID=$V($ZU(40,2,47)-(2*$ZU(40,0,4)),-2,4)
19 F I=1:1:MAXPID S PID=$V(I*4+BASE,-3,4) S:PID JOB(PID)=PID
20 S JJ="" F S JJ=$O(JOB(JJ)) Q:(FOUND=1)!(JJ="") D:$ZU(67,0,JJ)=2
21 .S PID=JOB(JJ)
22 .S XX=$V(-1,PID),PROG=$P(XX,"^",6),DEV=$P(XX,"^",3) S:PROG="" PROG="SystemJob"
23 .I $G(^XUTL("XQ",PID,"DUZ")) S ZDUZ=^XUTL("XQ",PID,"DUZ") S:ZDUZ=0 ZDUZ=".5" S USER=$P(^VA(200,ZDUZ,0),"^",1)
24 .; Do not allow the killing of a System Job or a % job.
25 .I (DEV[PRINTER)&(PROG'["%")&(PROG'="SystemJob") D
26 ..S FOUND=1
27 ..S ^TMP($J,"DEV",PID)=XX
28 ..S PADPID=PID_$E(" ",$L(PID)+1,6) ;pad pid for display
29 ..S PADRTN=$P(XX,"^",6)_$E(" ",$L($P(XX,"^",6))+1,10) ;pad routine for display
30 ..W !,!,"PID ","ROUTINE ","USER "," DEVICE "
31 ..W !,"--- ","------- ","---- "," ------ "
32 ..W !,PADPID,PADRTN,USER," ",$P(XX,"^",3),!
33 ..D KILLIT
34 I FOUND=0 W !,!,"...No job found using ",PRINTER,!
35EXIT K %,AAQLO,BASE,DANS,DEV,DIC,FOUND,I,JJ,JOB,KILLED,MAXPID
36 K PADPID,PADRTN,PID,PRINTER,PROG,RECORD,SW10,USER,TSK,TSKDEV,TSKPID,Y,XX,ZDUZ,ZTSK,^TMP($J,"DEV")
37 Q
38KILLIT K DIR
39 S DIR(0)="Y"
40 S DIR("A")="Are you sure you want to stop this process"
41 S DIR("B")="NO"
42 S DIR("?")=" Answer YES to kill the process."
43 D ^DIR
44 I 'Y W !,!,?5,"Tasks NOT stopped!",!
45 I $D(DTOUT) W $C(7) G END
46 K DIR,DIRUT,DTOUT,DUOUT
47 I 'Y G END
48 S KILLED=$$INT^ZZRESJOB(PID)
49 I KILLED=0 W !,!,"...PROCESS DEAD OR NOT RESPONDING",!
50 I KILLED=1 W !,!,"...PID# ",PID," has been stopped.",!
51 S TSK=0 F I=0:0 S TSK=$O(^%ZTSCH("TASK",TSK)) Q:TSK="" D
52 .S RECORD=^%ZTSCH("TASK",TSK),TSKDEV=$P(RECORD,"^",6),TSKPID=$P(RECORD,"^",10)
53 .I TSKPID=PID D
54 ..W !,"...PID# ",PID," was a tasked job. Removing Task# ",TSK," from the task list.",! S ZTSK=TSK H 2
55 ..L +^%ZTSCH("TASK",ZTSK)
56 ..K ^%ZTSCH("TASK",ZTSK)
57 ..W !?5,"...",ZTSK," removed."
58 ..L -^%ZTSCH("TASK",ZTSK)
59 ..W !?5,"...finished!",!
60 ..R !,"...Press RETURN to continue:",DANS:15 W !
61 Q
62END S JJ=10000 ;Dirty exit should not have a process number higher
63 Q
Note: See TracBrowser for help on using the repository browser.