INHOQR2 ; FRW/JMB ; 01 Oct 1999 15:06 ; Show GIS queue status - cont.
;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
;COPYRIGHT 1991-2000 SAIC
Q
;
IND ;Initialize INDAT array for next scan
N INQ,P,T
S INQ="" F S INQ=$O(INDAT(INQ)) Q:'$L(INQ) S INDAT(INQ,"COUNT")=0 D
. S P="" F S P=$O(INDAT(INQ,P)) Q:+P'=P&(P'="PEND") D ;if P="COUNT",it will Q
.. S T="" F S T=$O(INDAT(INQ,P,T)) Q:'$L(T) D
... S INDAT(INQ,P,T,"COUNT")=0
Q
;
DISP ;Display Report
;
N INQ,IN0,P,T
;Paint header
D HDR
;Work through INDAT array
; IN0 - Flag to display queue name only once
S INQ=0 F S INQ=$O(INDAT(INQ)) Q:'INQ D OV(INQ,0) S IN0=0 D
. S P="" F S P=$O(INDAT(INQ,P)) Q:((+P'=P)&(P'="PEND"))!('INPAR("DETAIL")) S T="" F S T=$O(INDAT(INQ,P,T)) Q:'$L(T) D DPRI(INQ,P,T,.IN0)
.;Display queues with 0 totals
.;If there is only one priority level for queue INQ, do not
.; display total by priority, since data is repeated
.;Display overall totals
.;Display Brief report
.I ('INDAT(INQ,"COUNT"))&(IN0=0)!(IN0>1)!(INQ>300)!('INPAR("DETAIL")) D OV(INQ,0),DTOT(INQ,IN0)
;Paint footer
D FTR
Q
;
DPRI(INQ,P,T,IN0) ;Display queue size by priority level
W ! W:'IN0 INDAT(INQ,"NAME") S IN0=IN0+1
W ?TAB(0)+2,P W:T="ST" " STAT"
W ?TAB(1),$J(INDAT(INQ,P,T,"COUNT"),7)
W ?TAB(2),$J(INDAT(INQ,P,T,"MIN"),7)
W ?TAB(3),$J(INDAT(INQ,P,T,"MAX"),7)
W ?TAB(4),$J(INDAT(INQ,P,T,"AVG"),7)
D:$L($O(INDAT(INQ,P,T)))!(+$O(INDAT(INQ,P))) OV(INQ,1)
Q
;
DTOT(INQ,IN0) ;Display queue totals
;
; New line before displaying: "Total" string, Queue name,
; Messages created per hr, transactions identified per hour.
W:INQ'=400 !
W:IN0>1 ?TAB(0),"Total:"
; One blank line before "Queue Total"
W:INQ=400 !!
; Display Queue Name if there are not entries in the queue
; Display "Queue Total", "Messages created per hour" or
; "Transactions identified per hour" strings
W:'IN0 INDAT(INQ,"NAME")
W ?TAB(1),$J(INDAT(INQ,"COUNT"),7),?TAB(2),$J(INDAT(INQ,"MIN"),7)
W ?TAB(3),$J(INDAT(INQ,"MAX"),7),?TAB(4),$J(INDAT(INQ,"AVG"),7)
; Blank line after priority totals
; One blank line before Queue Total
W:(IN0>1)&($O(INDAT(INQ))'=400) !
Q
;
OV(INQ,IN1) ;Handle overflow
;INPUT
; INQ - Process Id
; IN1 - 1 Repeat process Id
; - 0 Do not repeat process Id
Q:$Y<(IOSL-4)
W !!,"More..." F X=1:1:INPAR("REPAINT") Q:INTASKED R *%:1 Q:$T
D HDR
W:IN1 !,INDAT(INQ,"NAME")," Cont."
Q
;
HDR ;Diplay header
N T
;Calculate run time = now-start
S INRUN=$$TDIF^INHUTS(INPAR("START"),$H),INRUNASC=$$FORMAT^INHUTS(INRUN)
;Calculate average run time per iteration
S INRUNAVG=$$FORMAT^INHUTS(INRUN\INITER,2)
;Clear screen
W @IOF
W "GIS Queue Size",?55,$$CDATASC^UTDT($$NOW^UTDT,1,1)
W !,?5,"Start Time: ",$$CDATASC^UTDT(INPAR("START"),1,1),?40," Number of Iterations: ",INITER
W !,?5," Run Time: ",INRUNASC,?40,"Avg Time per Iteration: ",INRUNAVG
W !
;
W !,"Background Process"
W:INPAR("DETAIL") ?TAB(0),"Prio"
W ?TAB(1)," Curr",?TAB(2)," Min",?TAB(3)," Max",?TAB(4)," Avg"
W !,"---------------------"
W:INPAR("DETAIL") ?TAB(0),"-----"
F T=1:1:4 W ?TAB(T)," ------"
Q
;
FTR ;Display footer
;
I 'INTASKED W !!,"Press any key to exit: "
Q
INHOQR2 ; FRW/JMB ; 01 Oct 1999 15:06 ; Show GIS queue status - cont.
+1 ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
+2 ;COPYRIGHT 1991-2000 SAIC
+3 QUIT
+4 ;
IND ;Initialize INDAT array for next scan
+1 NEW INQ,P,T
+2 SET INQ=""
FOR
SET INQ=$ORDER(INDAT(INQ))
IF '$LENGTH(INQ)
QUIT
SET INDAT(INQ,"COUNT")=0
Begin DoDot:1
+3 ;if P="COUNT",it will Q
SET P=""
FOR
SET P=$ORDER(INDAT(INQ,P))
IF +P'=P&(P'="PEND")
QUIT
Begin DoDot:2
+4 SET T=""
FOR
SET T=$ORDER(INDAT(INQ,P,T))
IF '$LENGTH(T)
QUIT
Begin DoDot:3
+5 SET INDAT(INQ,P,T,"COUNT")=0
End DoDot:3
End DoDot:2
End DoDot:1
+6 QUIT
+7 ;
DISP ;Display Report
+1 ;
+2 NEW INQ,IN0,P,T
+3 ;Paint header
+4 DO HDR
+5 ;Work through INDAT array
+6 ; IN0 - Flag to display queue name only once
+7 SET INQ=0
FOR
SET INQ=$ORDER(INDAT(INQ))
IF 'INQ
QUIT
DO OV(INQ,0)
SET IN0=0
Begin DoDot:1
+8 SET P=""
FOR
SET P=$ORDER(INDAT(INQ,P))
IF ((+P'=P)&(P'="PEND"))!('INPAR("DETAIL"))
QUIT
SET T=""
FOR
SET T=$ORDER(INDAT(INQ,P,T))
IF '$LENGTH(T)
QUIT
DO DPRI(INQ,P,T,.IN0)
+9 ;Display queues with 0 totals
+10 ;If there is only one priority level for queue INQ, do not
+11 ; display total by priority, since data is repeated
+12 ;Display overall totals
+13 ;Display Brief report
+14 IF ('INDAT(INQ,"COUNT"))&(IN0=0)!(IN0>1)!(INQ>300)!('INPAR("DETAIL"))
DO OV(INQ,0)
DO DTOT(INQ,IN0)
End DoDot:1
+15 ;Paint footer
+16 DO FTR
+17 QUIT
+18 ;
DPRI(INQ,P,T,IN0) ;Display queue size by priority level
+1 WRITE !
IF 'IN0
WRITE INDAT(INQ,"NAME")
SET IN0=IN0+1
+2 WRITE ?TAB(0)+2,P
IF T="ST"
WRITE " STAT"
+3 WRITE ?TAB(1),$JUSTIFY(INDAT(INQ,P,T,"COUNT"),7)
+4 WRITE ?TAB(2),$JUSTIFY(INDAT(INQ,P,T,"MIN"),7)
+5 WRITE ?TAB(3),$JUSTIFY(INDAT(INQ,P,T,"MAX"),7)
+6 WRITE ?TAB(4),$JUSTIFY(INDAT(INQ,P,T,"AVG"),7)
+7 IF $LENGTH($ORDER(INDAT(INQ,P,T)))!(+$ORDER(INDAT(INQ,P)))
DO OV(INQ,1)
+8 QUIT
+9 ;
DTOT(INQ,IN0) ;Display queue totals
+1 ;
+2 ; New line before displaying: "Total" string, Queue name,
+3 ; Messages created per hr, transactions identified per hour.
+4 IF INQ'=400
WRITE !
+5 IF IN0>1
WRITE ?TAB(0),"Total:"
+6 ; One blank line before "Queue Total"
+7 IF INQ=400
WRITE !!
+8 ; Display Queue Name if there are not entries in the queue
+9 ; Display "Queue Total", "Messages created per hour" or
+10 ; "Transactions identified per hour" strings
+11 IF 'IN0
WRITE INDAT(INQ,"NAME")
+12 WRITE ?TAB(1),$JUSTIFY(INDAT(INQ,"COUNT"),7),?TAB(2),$JUSTIFY(INDAT(INQ,"MIN"),7)
+13 WRITE ?TAB(3),$JUSTIFY(INDAT(INQ,"MAX"),7),?TAB(4),$JUSTIFY(INDAT(INQ,"AVG"),7)
+14 ; Blank line after priority totals
+15 ; One blank line before Queue Total
+16 IF (IN0>1)&($ORDER(INDAT(INQ))'=400)
WRITE !
+17 QUIT
+18 ;
OV(INQ,IN1) ;Handle overflow
+1 ;INPUT
+2 ; INQ - Process Id
+3 ; IN1 - 1 Repeat process Id
+4 ; - 0 Do not repeat process Id
+5 IF $Y<(IOSL-4)
QUIT
+6 WRITE !!,"More..."
FOR X=1:1:INPAR("REPAINT")
IF INTASKED
QUIT
READ *%:1
IF $TEST
QUIT
+7 DO HDR
+8 IF IN1
WRITE !,INDAT(INQ,"NAME")," Cont."
+9 QUIT
+10 ;
HDR ;Diplay header
+1 NEW T
+2 ;Calculate run time = now-start
+3 SET INRUN=$$TDIF^INHUTS(INPAR("START"),$HOROLOG)
SET INRUNASC=$$FORMAT^INHUTS(INRUN)
+4 ;Calculate average run time per iteration
+5 SET INRUNAVG=$$FORMAT^INHUTS(INRUN\INITER,2)
+6 ;Clear screen
+7 WRITE @IOF
+8 WRITE "GIS Queue Size",?55,$$CDATASC^UTDT($$NOW^UTDT,1,1)
+9 WRITE !,?5,"Start Time: ",$$CDATASC^UTDT(INPAR("START"),1,1),?40," Number of Iterations: ",INITER
+10 WRITE !,?5," Run Time: ",INRUNASC,?40,"Avg Time per Iteration: ",INRUNAVG
+11 WRITE !
+12 ;
+13 WRITE !,"Background Process"
+14 IF INPAR("DETAIL")
WRITE ?TAB(0),"Prio"
+15 WRITE ?TAB(1)," Curr",?TAB(2)," Min",?TAB(3)," Max",?TAB(4)," Avg"
+16 WRITE !,"---------------------"
+17 IF INPAR("DETAIL")
WRITE ?TAB(0),"-----"
+18 FOR T=1:1:4
WRITE ?TAB(T)," ------"
+19 QUIT
+20 ;
FTR ;Display footer
+1 ;
+2 IF 'INTASKED
WRITE !!,"Press any key to exit: "
+3 QUIT