INHOA ;JMB; 15 Sep 95 08:27; Background Process Monitor
;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
;COPYRIGHT 1991-2000 SAIC
;
Q
EN ;Called from INHOP
;NEW statements
N BP0,BPC,INDAT,INQUEUE,INTOTAL,INDV,INDQ,X,OC
N DA,INDEST,DTOUT,GL,H,M,S,TAB,CUR
N INEXIT,IN0,INH,INI,INL,INRUN,INITER,INK,INQ,INWARN,INSIG,INT
N INRUNASC,INRUNAVG,P,SEL,T,TOP,STAT
;
;Initialize report variables
S INITER=0,INEXIT=0,INPAR("START")=$H
S BPC=$P(INPAR("PROCESS"),U)
;Initialize TABs
S TAB(1)=5,TAB(2)=37,TAB(3)=49,TAB(4)=58,TAB(5)=66,TAB(6)=74
;
;Queue size parameter
S INPAR("MSGSTART")=$P(^INTHU(0),U,3),INPAR("TSKSTART")=$P(^INLHFTSK(0),U,3)
;Init INDAT array, save INDAT
D INIARR(BPC),SQ
;
ENRPT ;Repeat entry point
;
;Init scan variables
S INITER=INITER+1,(INPAR("QSTART"),INPAR("REPSTART"))=$H
S (INWARN,INSIG,INTOTAL,INQUEUE)=0
D P1(BPC) G:INEXIT EXIT ;Verify status
D P3(BPC) G:INEXIT EXIT ;Top entries
D P2(BPC) G:INEXIT EXIT ;Queue size
;
G:$$QUIT^INHUTS EXIT ;handles INPAR("REPAINT")=0
;hang until next recalculation
F X=1:1:INPAR("REPAINT") S:'INTASKED INEXIT=$$QUIT^INHUTS Q:INEXIT H 1
G:INEXIT EXIT
G ENRPT
;
EXIT ;End of program
;Close device
D ^%ZISC
Q
;
P1(BPC) ;Part 1: Verify status of background process
;
;Restore INDAT stats
D RV
;Set warning flag INWARN to 1 if another user is running this report.
L +^INTHPC("AVERIFY"):1 E S INWARN=1
D VERIFY^INHOV1(BPC)
L:'INWARN -^INTHPC("AVERIFY")
;
Q:INEXIT
;Repeat display for terminals 1 time for printers
I 'INTASKED D DISV^INHOA1
;Check for end of tasked report
I INTASKED,INITER'<INPAR("ITER") D DISV^INHOA1 D SV Q
;
;Save INDAT stats
D SV
Q
;
P2(BPC) ;Part 2: Queue size sorted by priority
; Notice that: INDAT(1) - Format Controller (BPC=2)
; INDAT(2) - Output Controller (BPC=1)
;
;Restore INDAT
D RQ
;init INDAT by priority for next scan
D IND^INHOQR2
;Format controller, Notice that when $$QUEUE=1 => INEXIT=1
I BPC=2 Q:'$$QUEUE^INHOQR1("^INLHFTSK(""AH"")",$P(^INTHPC(2,0),U),1)
;Output Controller
I BPC=1 Q:'$$QUEUE^INHOQR1("^INLHSCH",$P(^INTHPC(1,0),U),2)
;Destination queue
I ";1;2;"'[BPC Q:'$$QUEUE^INHOQR1(U_$P(INDEST(BPC),U,2),$P(INDEST(BPC),U),BPC)
;
;Provide support for message creation rates
Q:'$$ENTRIES^INHOQR1("^INTHU","Messages created per hour",700,"MSGSTART")
;
;Provide support for transaction identification rates
Q:'$$ENTRIES^INHOQR1("^INLHFTSK","Transactions identified per hour",750,"TSKSTART")
;
;Repeat display for terminals, one time for printers
I 'INTASKED D DISQ^INHOA1
;Check for end of tasked report
; NOTICE: INEXIT=1 to exit (completed last part of report)
I INTASKED,INITER'<INPAR("ITER") D DISQ^INHOA1 S INEXIT=1 Q
;
;save INDAT
D SQ
Q
;
P3(BPC) ;Part 3: Show top entries in queue
;
;Init INDAT
K INDAT
;Format controller
I BPC=2 I '$$QUEUE^INHOQT1("^INLHFTSK(""AH"")",2) S INEXIT=1 Q
;Output Controller
I BPC=1 I '$$QUEUE^INHOQT1("^INLHSCH",1) S INEXIT=1 Q
;Destination queues
I ";1;2;"'[BPC I '$$QUEUE^INHOQT1(U_$P(INDEST(BPC),U,2),BPC) S INEXIT=1 Q
;
Q:INEXIT
;display report
D:'INTASKED DIST^INHOA1
;Check for end of tasked report
I INTASKED,INITER'<INPAR("ITER") D DIST^INHOA1 K INDAT Q
;
;Delete INDAT
K INDAT
;
Q
;
INIARR(BP) ;Init INDAT,INDEST for Queue size report
;OUTPUT:
; INDAT - array of data for each queue
;
;Determine destination to check
D INITQ(BP)
;
;Intialize data arrays
S BP=$S(BP=1:2,BP=2:1,1:BP)
D DATINIT(BP)
;
F BP=700,750 D DATINIT(BP)
Q
;
DATINIT(INQ) ;Initialize data array
;INPUT:
; INQ - queue entry (usually ien in Back Proc Control file)
;OUTPUT:
; INDAT - array of initialized data for a queue
;
F X="COUNT","MIN","MAX","AVG","NAME","ITER","TOTC" S INDAT(INQ,X)=""
Q
;
INITQ(BPC) ;Init
N BP0,D
S BP0=$G(^INTHPC(BPC,0))
S D=$P(BP0,U,7) Q:'D
;Check if process is NOT active and no messages in queue
Q:'$P(BP0,U,2)&'$D(^INLHDEST(D))
S INDEST(BP)=$P(BP0,U)_U_"INLHDEST("_D_")"
Q
;
RV M INDAT=INDV K INDV Q
SV M INDV=INDAT K INDAT Q
RQ M INDAT=INDQ K INDQ Q
SQ M INDQ=INDAT K INDAT Q
INHOA ;JMB; 15 Sep 95 08:27; Background Process Monitor
+1 ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
+2 ;COPYRIGHT 1991-2000 SAIC
+3 ;
+4 QUIT
EN ;Called from INHOP
+1 ;NEW statements
+2 NEW BP0,BPC,INDAT,INQUEUE,INTOTAL,INDV,INDQ,X,OC
+3 NEW DA,INDEST,DTOUT,GL,H,M,S,TAB,CUR
+4 NEW INEXIT,IN0,INH,INI,INL,INRUN,INITER,INK,INQ,INWARN,INSIG,INT
+5 NEW INRUNASC,INRUNAVG,P,SEL,T,TOP,STAT
+6 ;
+7 ;Initialize report variables
+8 SET INITER=0
SET INEXIT=0
SET INPAR("START")=$HOROLOG
+9 SET BPC=$PIECE(INPAR("PROCESS"),U)
+10 ;Initialize TABs
+11 SET TAB(1)=5
SET TAB(2)=37
SET TAB(3)=49
SET TAB(4)=58
SET TAB(5)=66
SET TAB(6)=74
+12 ;
+13 ;Queue size parameter
+14 SET INPAR("MSGSTART")=$PIECE(^INTHU(0),U,3)
SET INPAR("TSKSTART")=$PIECE(^INLHFTSK(0),U,3)
+15 ;Init INDAT array, save INDAT
+16 DO INIARR(BPC)
DO SQ
+17 ;
ENRPT ;Repeat entry point
+1 ;
+2 ;Init scan variables
+3 SET INITER=INITER+1
SET (INPAR("QSTART"),INPAR("REPSTART"))=$HOROLOG
+4 SET (INWARN,INSIG,INTOTAL,INQUEUE)=0
+5 ;Verify status
DO P1(BPC)
IF INEXIT
GOTO EXIT
+6 ;Top entries
DO P3(BPC)
IF INEXIT
GOTO EXIT
+7 ;Queue size
DO P2(BPC)
IF INEXIT
GOTO EXIT
+8 ;
+9 ;handles INPAR("REPAINT")=0
IF $$QUIT^INHUTS
GOTO EXIT
+10 ;hang until next recalculation
+11 FOR X=1:1:INPAR("REPAINT")
IF 'INTASKED
SET INEXIT=$$QUIT^INHUTS
IF INEXIT
QUIT
HANG 1
+12 IF INEXIT
GOTO EXIT
+13 GOTO ENRPT
+14 ;
EXIT ;End of program
+1 ;Close device
+2 DO ^%ZISC
+3 QUIT
+4 ;
P1(BPC) ;Part 1: Verify status of background process
+1 ;
+2 ;Restore INDAT stats
+3 DO RV
+4 ;Set warning flag INWARN to 1 if another user is running this report.
+5 LOCK +^INTHPC("AVERIFY"):1
IF '$TEST
SET INWARN=1
+6 DO VERIFY^INHOV1(BPC)
+7 IF 'INWARN
LOCK -^INTHPC("AVERIFY")
+8 ;
+9 IF INEXIT
QUIT
+10 ;Repeat display for terminals 1 time for printers
+11 IF 'INTASKED
DO DISV^INHOA1
+12 ;Check for end of tasked report
+13 IF INTASKED
IF INITER'<INPAR("ITER")
DO DISV^INHOA1
DO SV
QUIT
+14 ;
+15 ;Save INDAT stats
+16 DO SV
+17 QUIT
+18 ;
P2(BPC) ;Part 2: Queue size sorted by priority
+1 ; Notice that: INDAT(1) - Format Controller (BPC=2)
+2 ; INDAT(2) - Output Controller (BPC=1)
+3 ;
+4 ;Restore INDAT
+5 DO RQ
+6 ;init INDAT by priority for next scan
+7 DO IND^INHOQR2
+8 ;Format controller, Notice that when $$QUEUE=1 => INEXIT=1
+9 IF BPC=2
IF '$$QUEUE^INHOQR1("^INLHFTSK(""AH"")",$PIECE(^INTHPC(2,0),U),1)
QUIT
+10 ;Output Controller
+11 IF BPC=1
IF '$$QUEUE^INHOQR1("^INLHSCH",$PIECE(^INTHPC(1,0),U),2)
QUIT
+12 ;Destination queue
+13 IF ";1;2;"'[BPC
IF '$$QUEUE^INHOQR1(U_$PIECE(INDEST(BPC),U,2),$PIECE(INDEST(BPC),U),BPC)
QUIT
+14 ;
+15 ;Provide support for message creation rates
+16 IF '$$ENTRIES^INHOQR1("^INTHU","Messages created per hour",700,"MSGSTART")
QUIT
+17 ;
+18 ;Provide support for transaction identification rates
+19 IF '$$ENTRIES^INHOQR1("^INLHFTSK","Transactions identified per hour",750,"TSKSTART")
QUIT
+20 ;
+21 ;Repeat display for terminals, one time for printers
+22 IF 'INTASKED
DO DISQ^INHOA1
+23 ;Check for end of tasked report
+24 ; NOTICE: INEXIT=1 to exit (completed last part of report)
+25 IF INTASKED
IF INITER'<INPAR("ITER")
DO DISQ^INHOA1
SET INEXIT=1
QUIT
+26 ;
+27 ;save INDAT
+28 DO SQ
+29 QUIT
+30 ;
P3(BPC) ;Part 3: Show top entries in queue
+1 ;
+2 ;Init INDAT
+3 KILL INDAT
+4 ;Format controller
+5 IF BPC=2
IF '$$QUEUE^INHOQT1("^INLHFTSK(""AH"")",2)
SET INEXIT=1
QUIT
+6 ;Output Controller
+7 IF BPC=1
IF '$$QUEUE^INHOQT1("^INLHSCH",1)
SET INEXIT=1
QUIT
+8 ;Destination queues
+9 IF ";1;2;"'[BPC
IF '$$QUEUE^INHOQT1(U_$PIECE(INDEST(BPC),U,2),BPC)
SET INEXIT=1
QUIT
+10 ;
+11 IF INEXIT
QUIT
+12 ;display report
+13 IF 'INTASKED
DO DIST^INHOA1
+14 ;Check for end of tasked report
+15 IF INTASKED
IF INITER'<INPAR("ITER")
DO DIST^INHOA1
KILL INDAT
QUIT
+16 ;
+17 ;Delete INDAT
+18 KILL INDAT
+19 ;
+20 QUIT
+21 ;
INIARR(BP) ;Init INDAT,INDEST for Queue size report
+1 ;OUTPUT:
+2 ; INDAT - array of data for each queue
+3 ;
+4 ;Determine destination to check
+5 DO INITQ(BP)
+6 ;
+7 ;Intialize data arrays
+8 SET BP=$SELECT(BP=1:2,BP=2:1,1:BP)
+9 DO DATINIT(BP)
+10 ;
+11 FOR BP=700,750
DO DATINIT(BP)
+12 QUIT
+13 ;
DATINIT(INQ) ;Initialize data array
+1 ;INPUT:
+2 ; INQ - queue entry (usually ien in Back Proc Control file)
+3 ;OUTPUT:
+4 ; INDAT - array of initialized data for a queue
+5 ;
+6 FOR X="COUNT","MIN","MAX","AVG","NAME","ITER","TOTC"
SET INDAT(INQ,X)=""
+7 QUIT
+8 ;
INITQ(BPC) ;Init
+1 NEW BP0,D
+2 SET BP0=$GET(^INTHPC(BPC,0))
+3 SET D=$PIECE(BP0,U,7)
IF 'D
QUIT
+4 ;Check if process is NOT active and no messages in queue
+5 IF '$PIECE(BP0,U,2)&'$DATA(^INLHDEST(D))
QUIT
+6 SET INDEST(BP)=$PIECE(BP0,U)_U_"INLHDEST("_D_")"
+7 QUIT
+8 ;
RV MERGE INDAT=INDV
KILL INDV
QUIT
SV MERGE INDV=INDAT
KILL INDAT
QUIT
RQ MERGE INDAT=INDQ
KILL INDQ
QUIT
SQ MERGE INDQ=INDAT
KILL INDAT
QUIT