1 | %ZIBRUN ; IHS/ADC/GTH - CHECK FOR ACTIVE ROUTINE IN A SPECIFIC UCI ; [ 02/07/97 3:02 PM ]
|
---|
2 | ;;4.0;XB;;Jul 20, 2009;Build 2
|
---|
3 | ;
|
---|
4 | EN ;
|
---|
5 | Q:'($ZV?1"MSM".E!($ZV?1"DSM".E)) ; Only works for MSM or DSM.
|
---|
6 | ; Name of routine to be checked is passed in X.
|
---|
7 | S %ZIB("PARM")=X
|
---|
8 | S:$P(%ZIB("PARM"),"^",2)="" $P(%ZIB("PARM"),"^",2)=$ZU(0) ; If no UCI set to current UCI.
|
---|
9 | S %ZIB("OP SYS")=$ZV ; Set operating system.
|
---|
10 | D @$S(%ZIB("OP SYS")?1"DSM".E:"DSM",1:"MSM") ; Active JOB lookup per operating system.
|
---|
11 | D CK
|
---|
12 | D OUT ; KILL off variables and exit gracefully.
|
---|
13 | Q
|
---|
14 | ;
|
---|
15 | MSM ; MSM specific look up active JOBs.
|
---|
16 | S $ZT="MER"
|
---|
17 | V 44:$J:$ZB($V(44,$J,2),1,7):2
|
---|
18 | S %ZIB("SYS TBL")=$V(44),%ZIB("JOB TBL")=$V(%ZIB("SYS TBL")+8,-3,2)+%ZIB("SYS TBL"),%ZIB("MAX JOBS")=$V($V(%ZIB("SYS TBL")+284),-3,4),%ZIB("PARTITION")=$V(3*4+%ZIB("JOB TBL"))
|
---|
19 | ; Build active JOB table (%ZIB("ACT JOB")
|
---|
20 | F %ZIB("ACT JOB")=1:1:%ZIB("MAX JOBS") S:$V(%ZIB("ACT JOB")*4+%ZIB("PARTITION")) $P(%ZIB("JOB TABLE",%ZIB("ACT JOB")),"^",2)=$ZU(($V(2,%ZIB("ACT JOB"),2)#32),($V(2,%ZIB("ACT JOB"),2)\32))
|
---|
21 | Q
|
---|
22 | ;
|
---|
23 | MER ; MSM error trap.
|
---|
24 | V 44:$J:$ZB($V(44,$J,2),#FFFE,1):2
|
---|
25 | ZQ
|
---|
26 | ;
|
---|
27 | DSM ; DSM specific look up active JOBs.
|
---|
28 | S %ZIB("SYS TBL")=$V(44),%ZIB("JOB TBL")=$V(%ZIB("SYS TBL")+4)
|
---|
29 | ; Build active JOB table (%ZIB("JOB TABLE"))
|
---|
30 | F %ZIB("JOB OFFSET")=%ZIB("JOB TBL")+2:2:%ZIB("JOB TBL")+126 I $V(%ZIB("JOB OFFSET")+1),$V(%ZIB("JOB OFFSET")+1)'=244 D
|
---|
31 | . S %ZIB("ACT JOB")=%ZIB("JOB OFFSET")-%ZIB("JOB TBL")\2
|
---|
32 | . I %ZIB("ACT JOB")]"" D
|
---|
33 | .. S %ZIB("UCI NBR")=$V(149,%ZIB("ACT JOB"))
|
---|
34 | .. I %ZIB("UCI NBR")]"" D
|
---|
35 | ... S $P(%ZIB("JOB TABLE",%ZIB("ACT JOB")),"^",2)=$ZU(%ZIB("UCI NBR"))
|
---|
36 | ... S %ZIB("ACT RTN")=""
|
---|
37 | ... F %ZIB("LOC")=502:1:509 Q:$V(%ZIB("LOC"),%ZIB("ACT JOB"))#256>127!'$V(%ZIB("LOC"),%ZIB("ACT JOB")) S %ZIB("ACT RTN")=%ZIB("ACT RTN")_$C($V(%ZIB("LOC"),%ZIB("ACT JOB"))#128)
|
---|
38 | ... S $P(%ZIB("JOB TABLE",%ZIB("ACT JOB")),"^",1)=%ZIB("ACT RTN")
|
---|
39 | Q
|
---|
40 | ;
|
---|
41 | CK ; Check %ZIB("JOB TABLE) for match of ROUTINE^UCI.
|
---|
42 | S %ZIB("$T")=0,%ZIB("JOB NBR")=""
|
---|
43 | F S %ZIB("JOB NBR")=$O(%ZIB("JOB TABLE",%ZIB("JOB NBR"))) Q:%ZIB("JOB NBR")="" I %ZIB("JOB TABLE",%ZIB("JOB NBR"))=%ZIB("PARM") S %ZIB("$T")=1 Q
|
---|
44 | Q
|
---|
45 | ;
|
---|
46 | OUT ;
|
---|
47 | I $ZV?1"MSM".E V 44:$J:$ZB($V(44,$J,2),#FFFE,1):2
|
---|
48 | I %ZIB("$T")
|
---|
49 | Q
|
---|
50 | ;
|
---|