1 | %ZTLOAD4 ;SEA/RDS-TaskMan: P I: Is Queued? ;1/24/08 16:15
|
---|
2 | ;;8.0;KERNEL;**440**;JUL 10, 1995;Build 13
|
---|
3 | ;Per VHA Directive 2004-038, this routine should not be modified
|
---|
4 | ;Call with ZTSK, [ZTCPU]; Return ZTSK()
|
---|
5 | INPUT ;check input parameters for error conditions
|
---|
6 | N %,$ES,$ET,%ZTVOL,ZTREC,ZTD,ZT1,ZT2,ZT3
|
---|
7 | I $D(ZTSK)[0 S ZTSK=""
|
---|
8 | I $D(ZTSK)>1 S %=ZTSK K ZTSK S ZTSK=%
|
---|
9 | I ZTSK<1!(ZTSK\1'=ZTSK) S ZTSK="",ZTSK(0)="",ZTSK("E")="IT" G QUIT
|
---|
10 | S ZTSK(0)="",ZTSK("E")="U",$ET="Q:$ES S $EC="""" G QUIT^%ZTLOAD4"
|
---|
11 | S %ZTVOL=^%ZOSF("VOL")
|
---|
12 | I $D(ZTCPU)[0 S ZTCPU=%ZTVOL
|
---|
13 | I ZTCPU="" S ZTCPU=%ZTVOL
|
---|
14 | I ZTCPU'=%ZTVOL G THERE
|
---|
15 | ;
|
---|
16 | HERE ;lookup task's status on current volume set
|
---|
17 | L +^%ZTSK(ZTSK):1
|
---|
18 | I $D(^%ZTSK(ZTSK,0))[0 S ZTSK("E")="I" G QUIT
|
---|
19 | S ZTREC=^%ZTSK(ZTSK,0),ZTD=$G(^(.04))
|
---|
20 | S ZTSK("DUZ")=$P(ZTREC,U,3),ZTSK("D")=$P(ZTREC,U,6) ;scheduled $H
|
---|
21 | I ZTD]"",$D(^%ZTSCH(ZTD,ZTSK))#2 S ZTSK(0)=1 G QUIT
|
---|
22 | I ZTD]"",$D(^%ZTSCH("JOB",ZTD,ZTSK))#2 S ZTSK(0)=1 G QUIT
|
---|
23 | ;
|
---|
24 | S ZT1="" F S ZT1=$O(^%ZTSCH(ZT1)) Q:'ZT1 I $D(^(ZT1,ZTSK))#2 S ZTSK(0)=1 G QUIT
|
---|
25 | S ZT1="IO",ZT2="" F S ZT2=$O(^%ZTSCH(ZT1,ZT2)),ZT3="" Q:ZT2="" F S ZT3=$O(^%ZTSCH(ZT1,ZT2,ZT3)) Q:ZT3="" I $D(^(ZT3,ZTSK))#2 S ZTSK(0)=1 G QUIT
|
---|
26 | S ZT1="JOB",ZT2="" F S ZT2=$O(^%ZTSCH(ZT1,ZT2)) Q:ZT2="" I $D(^(ZT2,ZTSK))#2 S ZTSK(0)=1 G QUIT
|
---|
27 | S ZT1="LINK",ZT2="" F S ZT2=$O(^%ZTSCH(ZT1,ZT2)),ZT3="" Q:ZT2="" F S ZT3=$O(^%ZTSCH(ZT1,ZT2,ZT3)) Q:ZT3="" I $D(^(ZT3,ZTSK))#2 S ZTSK(0)=1 G QUIT
|
---|
28 | S ZTSK(0)=0
|
---|
29 | ;
|
---|
30 | QUIT ;cleanup and quit
|
---|
31 | L:ZTSK -^%ZTSK(ZTSK) ;K %ZTCPU,%ZTM,%ZTM1,%ZTM2,%ZTMAST,%ZTVOL,X,Y,ZT,ZT1,ZT2,ZT3,ZTCPU,ZTD,ZTREC
|
---|
32 | I ZTSK(0)]"" K ZTSK("E") Q
|
---|
33 | I ZTSK("E")'="U" Q
|
---|
34 | S ZTSK("E",0)=$$EC^%ZOSV
|
---|
35 | Q
|
---|
36 | ;
|
---|
37 | THERE ;rest of code looks up task's status on some other volume set
|
---|
38 | N %ZTCPU,%ZTM,X,Y
|
---|
39 | ;
|
---|
40 | FILES ;find TaskMan files on the volume set to be searched
|
---|
41 | S %ZTCPU=$O(^%ZIS(14.5,"B",ZTCPU,""))
|
---|
42 | I %ZTCPU="" S ZTSK("E")="IS" G QUIT
|
---|
43 | S %ZTM=$P(^%ZOSF("MGR"),",")
|
---|
44 | S %ZTM=$S($D(^%ZIS(14.5,%ZTCPU,0))[0:%ZTM,$P(^(0),U,6)="":%ZTM,1:$P(^(0),U,6))
|
---|
45 | S X=%ZTM,Y=ZTCPU
|
---|
46 | S ZTSK("E")="LS",ZT=$D(^[X,Y]%ZTSK(0)),ZTSK("E")="U" ; check link
|
---|
47 | ;
|
---|
48 | SEARCH ;find out if task is queued on that volume set
|
---|
49 | I $D(^[X,Y]%ZTSK(ZTSK,0))[0 S ZTSK("E")="I" G QUIT
|
---|
50 | S ZTREC=^[X,Y]%ZTSK(ZTSK,0),ZTD=$G(^(.04))
|
---|
51 | S ZTSK("DUZ")=$P(ZTREC,U,3),ZTSK("D")=$P(ZTREC,U,6)
|
---|
52 | I ZTD]"",$D(^[X,Y]%ZTSCH(ZTD,ZTSK))#2 S ZTSK(0)=1 G QUIT
|
---|
53 | I ZTD]"",$D(^[X,Y]%ZTSCH("JOB",ZTD,ZTSK))#2 S ZTSK(0)=1 G QUIT
|
---|
54 | ;
|
---|
55 | S ZT1="" F S ZT1=$O(^[X,Y]%ZTSCH(ZT1)) Q:'ZT1 I $D(^(ZT1,ZTSK))#2 S ZTSK(0)=1 G QUIT
|
---|
56 | S ZT1="IO",ZT2="" F S ZT2=$O(^[X,Y]%ZTSCH(ZT1,ZT2)),ZT3="" Q:ZT2="" F S ZT3=$O(^[X,Y]%ZTSCH(ZT1,ZT2,ZT3)) Q:ZT3="" I $D(^(ZT3,ZTSK))#2 S ZTSK(0)=1 G QUIT
|
---|
57 | S ZT1="JOB",ZT2="" F S ZT2=$O(^[X,Y]%ZTSCH(ZT1,ZT2)) Q:ZT2="" I $D(^(ZT2,ZTSK))#2 S ZTSK(0)=1 G QUIT
|
---|
58 | S ZT1="LINK",ZT2="" F S ZT2=$O(^[X,Y]%ZTSCH(ZT1,ZT2)),ZT3="" Q:ZT2="" F S ZT3=$O(^[X,Y]%ZTSCH(ZT1,ZT2,ZT3)) Q:ZT3="" I $D(^(ZT3,ZTSK))#2 S ZTSK(0)=1 G QUIT
|
---|
59 | S ZTSK(0)=0 G QUIT
|
---|
60 | ;
|
---|