%ZIBRUN ; IHS/ADC/GTH - CHECK FOR ACTIVE ROUTINE IN A SPECIFIC UCI ; [ 02/07/97 3:02 PM ]
;;3.0;IHS/VA UTILITIES;;FEB 07, 1997
;
EN ;
Q:'($ZV?1"MSM".E!($ZV?1"DSM".E)) ; Only works for MSM or DSM.
; Name of routine to be checked is passed in X.
S %ZIB("PARM")=X
S:$P(%ZIB("PARM"),"^",2)="" $P(%ZIB("PARM"),"^",2)=$ZU(0) ; If no UCI set to current UCI.
S %ZIB("OP SYS")=$ZV ; Set operating system.
D @$S(%ZIB("OP SYS")?1"DSM".E:"DSM",1:"MSM") ; Active JOB lookup per operating system.
D CK
D OUT ; KILL off variables and exit gracefully.
Q
;
MSM ; MSM specific look up active JOBs.
S $ZT="MER"
V 44:$J:$ZB($V(44,$J,2),1,7):2
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"))
; Build active JOB table (%ZIB("ACT JOB")
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))
Q
;
MER ; MSM error trap.
V 44:$J:$ZB($V(44,$J,2),#FFFE,1):2
ZQ
;
DSM ; DSM specific look up active JOBs.
S %ZIB("SYS TBL")=$V(44),%ZIB("JOB TBL")=$V(%ZIB("SYS TBL")+4)
; Build active JOB table (%ZIB("JOB TABLE"))
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
. S %ZIB("ACT JOB")=%ZIB("JOB OFFSET")-%ZIB("JOB TBL")\2
. I %ZIB("ACT JOB")]"" D
.. S %ZIB("UCI NBR")=$V(149,%ZIB("ACT JOB"))
.. I %ZIB("UCI NBR")]"" D
... S $P(%ZIB("JOB TABLE",%ZIB("ACT JOB")),"^",2)=$ZU(%ZIB("UCI NBR"))
... S %ZIB("ACT RTN")=""
... 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)
... S $P(%ZIB("JOB TABLE",%ZIB("ACT JOB")),"^",1)=%ZIB("ACT RTN")
Q
;
CK ; Check %ZIB("JOB TABLE) for match of ROUTINE^UCI.
S %ZIB("$T")=0,%ZIB("JOB NBR")=""
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
Q
;
OUT ;
I $ZV?1"MSM".E V 44:$J:$ZB($V(44,$J,2),#FFFE,1):2
I %ZIB("$T")
Q
;
%ZIBRUN ; IHS/ADC/GTH - CHECK FOR ACTIVE ROUTINE IN A SPECIFIC UCI ; [ 02/07/97 3:02 PM ]
+1 ;;3.0;IHS/VA UTILITIES;;FEB 07, 1997
+2 ;
EN ;
+1 ; Only works for MSM or DSM.
IF '($ZV?1"MSM".E!($ZV?1"DSM".E))
QUIT
+2 ; Name of routine to be checked is passed in X.
+3 SET %ZIB("PARM")=X
+4 ; If no UCI set to current UCI.
IF $PIECE(%ZIB("PARM"),"^",2)=""
SET $PIECE(%ZIB("PARM"),"^",2)=$ZU(0)
+5 ; Set operating system.
SET %ZIB("OP SYS")=$ZV
+6 ; Active JOB lookup per operating system.
DO @$SELECT(%ZIB("OP SYS")?1"DSM".E:"DSM",1:"MSM")
+7 DO CK
+8 ; KILL off variables and exit gracefully.
DO OUT
+9 QUIT
+10 ;
MSM ; MSM specific look up active JOBs.
+1 SET $ZT="MER"
+2 VIEW 44:$JOB:$ZB($VIEW(44,$JOB,2),1,7):2
+3 SET %ZIB("SYS TBL")=$VIEW(44)
SET %ZIB("JOB TBL")=$VIEW(%ZIB("SYS TBL")+8,-3,2)+%ZIB("SYS TBL")
SET %ZIB("MAX JOBS")=$VIEW($VIEW(%ZIB("SYS TBL")+284),-3,4)
SET %ZIB("PARTITION")=$VIEW(3*4+%ZIB("JOB TBL"))
+4 ; Build active JOB table (%ZIB("ACT JOB")
+5 FOR %ZIB("ACT JOB")=1:1:%ZIB("MAX JOBS")
IF $VIEW(%ZIB("ACT JOB")*4+%ZIB("PARTITION"))
SET $PIECE(%ZIB("JOB TABLE",%ZIB("ACT JOB")),"^",2)=$ZU(($VIEW(2,%ZIB("ACT JOB"),2)#32),($VIEW(2,%ZIB("ACT JOB"),2)\32))
+6 QUIT
+7 ;
MER ; MSM error trap.
+1 VIEW 44:$JOB:$ZB($VIEW(44,$JOB,2),#FFFE,1):2
+2
*** ERROR ***
+3 ;
DSM ; DSM specific look up active JOBs.
+1 SET %ZIB("SYS TBL")=$VIEW(44)
SET %ZIB("JOB TBL")=$VIEW(%ZIB("SYS TBL")+4)
+2 ; Build active JOB table (%ZIB("JOB TABLE"))
+3 FOR %ZIB("JOB OFFSET")=%ZIB("JOB TBL")+2:2:%ZIB("JOB TBL")+126
IF $VIEW(%ZIB("JOB OFFSET")+1)
IF $VIEW(%ZIB("JOB OFFSET")+1)'=244
Begin DoDot:1
+4 SET %ZIB("ACT JOB")=%ZIB("JOB OFFSET")-%ZIB("JOB TBL")\2
+5 IF %ZIB("ACT JOB")]""
Begin DoDot:2
+6 SET %ZIB("UCI NBR")=$VIEW(149,%ZIB("ACT JOB"))
+7 IF %ZIB("UCI NBR")]""
Begin DoDot:3
+8 SET $PIECE(%ZIB("JOB TABLE",%ZIB("ACT JOB")),"^",2)=$ZU(%ZIB("UCI NBR"))
+9 SET %ZIB("ACT RTN")=""
+10 FOR %ZIB("LOC")=502:1:509
IF $VIEW(%ZIB("LOC"),%ZIB("ACT JOB"))#256>127!'$VIEW(%ZIB("LOC"),%ZIB("ACT JOB"))
QUIT
SET %ZIB("ACT RTN")=%ZIB("ACT RTN")_$CHAR($VIEW(%ZIB("LOC"),%ZIB("ACT JOB"))#128)
+11 SET $PIECE(%ZIB("JOB TABLE",%ZIB("ACT JOB")),"^",1)=%ZIB("ACT RTN")
End DoDot:3
End DoDot:2
End DoDot:1
+12 QUIT
+13 ;
CK ; Check %ZIB("JOB TABLE) for match of ROUTINE^UCI.
+1 SET %ZIB("$T")=0
SET %ZIB("JOB NBR")=""
+2 FOR
SET %ZIB("JOB NBR")=$ORDER(%ZIB("JOB TABLE",%ZIB("JOB NBR")))
IF %ZIB("JOB NBR")=""
QUIT
IF %ZIB("JOB TABLE",%ZIB("JOB NBR"))=%ZIB("PARM")
SET %ZIB("$T")=1
QUIT
+3 QUIT
+4 ;
OUT ;
+1 IF $ZV?1"MSM".E
VIEW 44:$JOB:$ZB($VIEW(44,$JOB,2),#FFFE,1):2
+2 IF %ZIB("$T")
+3 QUIT
+4 ;