HLOESTAT ;ALB/CJM- HLO ERROR STATISTICS- 10/4/94 1pm ;03/12/2007
;;1.6;HEALTH LEVEL SEVEN;**134**;Oct 13, 1995;Build 30
;Per VHA Directive 2004-038, this routine should not be modified.
;
;
COUNT(DIR,RAP,SAP,MSGTYPE,EVENT) ;
;DIR="IN" or "OUT", the "E" appended to diferentiate error stats
N TYPE
S:RAP="" RAP="UNKNOWN"
S:SAP="" SAP="UNKNOWN"
S TYPE=$G(MSGTYPE)
I $L($G(EVENT)) S TYPE=TYPE_"~"_$G(EVENT)
S:$L(TYPE)<2 TYPE="UNKNOWN"
I $$INC^HLOSITE($NA(^HLSTATS("E"_DIR,"HOURLY",+$E($$NOW^XLFDT,1,10),SAP,RAP,TYPE)))
Q
;
REPORT ;Interactive option for printing the message error statistics report
N DIR,TYPE,START,END
W !,"Hourly, daily, and monthly error statistics are maintained."
W !,"Hourly statistics are available for approximately the last 24 hours."
W !,"Daily statistics are available for approximately the last 30 days."
W !,"Monthly statistics are kept indefinitely"
S DIR(0)="S^h:HOURLY;d:DAILY;m:MONTHLY"
S DIR("A")="Which type of error statistics should be reported"
S DIR("B")="MONTHLY"
D ^DIR
Q:$D(DIRUT)
I Y'="h",Y'="d",Y'="m" Q
S TYPE=$S(Y="h":"HOURLY",Y="d":"DAILY",1:"MONTHLY")
S START=$S(TYPE="HOURLY":$E($$FMADD^XLFDT($$NOW^XLFDT,,-24),1,10),TYPE="DAILY":$$FMADD^XLFDT(DT,-7),1:$E($$FMADD^XLFDT(DT,-30),1,5)_"01")
S START=$$ASKBEGIN^HLOUSR2(START)
Q:'START
S END=$$ASKEND^HLOUSR2(START)
Q:'END
S:TYPE="MONTHLY" START=$E(START,1,5)_"00"
S:TYPE="DAILY" START=$E(START,1,7)
S:TYPE="HOURLY" START=$E(START,1,10)
D:$$DEVICE() PRINT(TYPE,START,END)
Q
;
QUE ;entry point for queuing the message statistics report
D PRINT($G(HLOPARMS("STATISTICS TYPE")),$G(HLOPARMS("START DT/TM")),$G(HLOPARMS("END DT/TM")))
Q
;
PRINT(STATTYPE,START,END) ;
;
N RAP,SAP,TIME,DIR,COUNT,PAGE,CRT,QUIT
S QUIT=0
S CRT=$S($E(IOST,1,2)="C-":1,1:0)
;
U IO
W:CRT @IOF
W "HLO MESSAGE ERROR STATISTICS REPORT ",$$FMTE^XLFDT($$NOW^XLFDT),?70,"Page 1"
D LINE($$LJ("Type:",15)_STATTYPE)
D LINE($$LJ("Beginning:",15)_$S(STATTYPE="MONTHLY":$$FMTE^XLFDT(START),1:$$FMTE^XLFDT(START)))
D LINE($$LJ("Ending:",15)_$$FMTE^XLFDT(END))
S PAGE=1
;
;
F DIR="EIN","EOUT" D Q:QUIT
.N TOTAL
.S TOTAL=0
.D LINE(" ")
.S TIME=START
.S:STATTYPE="MONTHLY" TIME=$E(TIME,1,5)
.S TIME=TIME-.0001
.D LINE($S(DIR="EIN":"INCOMING MESSAGES:",1:"OUTGOING MESSAGES:"))
.Q:QUIT
.F S TIME=$O(^HLSTATS(DIR,STATTYPE,TIME)) Q:((TIME>$G(END))&$G(END)) Q:'TIME D Q:QUIT
..N SUBTOTAL
..S SUBTOTAL=0
..D LINE(" ")
..Q:QUIT
..D LINE(" Time Period: "_$S(STATTYPE="MONTHLY":$$FMTE^XLFDT(TIME_"00"),1:$$FMTE^XLFDT(TIME)))
..Q:QUIT
..S SAP=""
..F S SAP=$O(^HLSTATS(DIR,STATTYPE,TIME,SAP)) Q:SAP="" D Q:QUIT
...D LINE(" Sending Application: "_SAP)
...Q:QUIT
...S RAP=""
...F S RAP=$O(^HLSTATS(DIR,STATTYPE,TIME,SAP,RAP)) Q:RAP="" D Q:QUIT
....D LINE(" Receiving Application: "_RAP)
....Q:QUIT
....S TYPE=""
....F S TYPE=$O(^HLSTATS(DIR,STATTYPE,TIME,SAP,RAP,TYPE)) Q:TYPE="" D Q:QUIT
.....S COUNT=$G(^HLSTATS(DIR,STATTYPE,TIME,SAP,RAP,TYPE))
.....S SUBTOTAL=SUBTOTAL+COUNT
.....D LINE(" Message Type: "_$$LJ(TYPE,25)_" Count:"_$$RJ(COUNT,10))
.....Q:QUIT
..I 'QUIT D
...S TOTAL=TOTAL+SUBTOTAL
...D LINE(" "),LINE($$RJ("**"_STATTYPE_" SUBTOTAL: ",68)_$$RJ(SUBTOTAL,10))
.D:'QUIT LINE(" "),LINE($$RJ("** TOTAL "_$S(DIR="EIN":"INCOMING",1:"OUTGOING")_" MESSAGE ERRORS: ",68)_$$RJ(TOTAL,10))
I CRT,'QUIT D PAUSE2
I $D(ZTQUEUED) S ZTREQ="@"
D ^%ZISC
Q
;
DEVICE() ;
;Description: allows the user to select a device.
;Input: none
;
;Output:
; Function Value - Returns 0 if the user decides not to print or to
; queue the report, 1 otherwise.
;
N OK,HLOPARMS
S OK=1
S %ZIS="MQ"
D ^%ZIS
S:POP OK=0
D:OK&$D(IO("Q"))
.S HLOPARMS("STATISTICS TYPE")=TYPE,HLOPARMS("START DT/TM")=START,HLOPARMS("END DT/TM")=END
.S ZTRTN="QUE^HLOESTAT",ZTDESC="HLO ERROR STATISTICS REPORT",ZTSAVE("HLOPARMS(")=""
.D ^%ZTLOAD
.W !,$S($D(ZTSK):"REQUEST QUEUED TASK="_ZTSK,1:"REQUEST CANCELLED")
.D HOME^%ZIS
.S OK=0
Q OK
;
PAUSE ;
;First scrolls to the bottome of the page, then does a screen pause. Sets QUIT=1 if user decides to quit.
;
N DIR,X,Y
F Q:$Y>(IOSL-3) W !
S DIR(0)="E"
D ^DIR
I ('(+Y))!$D(DIRUT) S QUIT=1
Q
PAUSE2 ;
;Screen pause without scrolling. Sets QUIT=1 if user decides to quit.
;
N DIR,X,Y
S DIR(0)="E"
D ^DIR
I ('(+Y))!$D(DIRUT) S QUIT=1
Q
;
LINE(LINE) ;Prints a line.
;
I CRT,($Y>(IOSL-4)) D
.D PAUSE
.Q:QUIT
.W @IOF
.W LINE
;
E I ('CRT),($Y>(IOSL-2)) D
.W @IOF
.W ?70,"Page: ",PAGE
.S PAGE=PAGE+1
.W LINE
;
E W !,LINE
Q
;
LJ(STRING,LEN) ;
Q $$LJ^XLFSTR($E(STRING,1,LEN),LEN)
RJ(STRING,LEN) ;
Q $$RJ^XLFSTR($E(STRING,1,LEN),LEN)
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HHLOESTAT 4839 printed Oct 16, 2024@17:59:29 Page 2
HLOESTAT ;ALB/CJM- HLO ERROR STATISTICS- 10/4/94 1pm ;03/12/2007
+1 ;;1.6;HEALTH LEVEL SEVEN;**134**;Oct 13, 1995;Build 30
+2 ;Per VHA Directive 2004-038, this routine should not be modified.
+3 ;
+4 ;
COUNT(DIR,RAP,SAP,MSGTYPE,EVENT) ;
+1 ;DIR="IN" or "OUT", the "E" appended to diferentiate error stats
+2 NEW TYPE
+3 if RAP=""
SET RAP="UNKNOWN"
+4 if SAP=""
SET SAP="UNKNOWN"
+5 SET TYPE=$GET(MSGTYPE)
+6 IF $LENGTH($GET(EVENT))
SET TYPE=TYPE_"~"_$GET(EVENT)
+7 if $LENGTH(TYPE)<2
SET TYPE="UNKNOWN"
+8 IF $$INC^HLOSITE($NAME(^HLSTATS("E"_DIR,"HOURLY",+$EXTRACT($$NOW^XLFDT,1,10),SAP,RAP,TYPE)))
+9 QUIT
+10 ;
REPORT ;Interactive option for printing the message error statistics report
+1 NEW DIR,TYPE,START,END
+2 WRITE !,"Hourly, daily, and monthly error statistics are maintained."
+3 WRITE !,"Hourly statistics are available for approximately the last 24 hours."
+4 WRITE !,"Daily statistics are available for approximately the last 30 days."
+5 WRITE !,"Monthly statistics are kept indefinitely"
+6 SET DIR(0)="S^h:HOURLY;d:DAILY;m:MONTHLY"
+7 SET DIR("A")="Which type of error statistics should be reported"
+8 SET DIR("B")="MONTHLY"
+9 DO ^DIR
+10 if $DATA(DIRUT)
QUIT
+11 IF Y'="h"
IF Y'="d"
IF Y'="m"
QUIT
+12 SET TYPE=$SELECT(Y="h":"HOURLY",Y="d":"DAILY",1:"MONTHLY")
+13 SET START=$SELECT(TYPE="HOURLY":$EXTRACT($$FMADD^XLFDT($$NOW^XLFDT,,-24),1,10),TYPE="DAILY":$$FMADD^XLFDT(DT,-7),1:$EXTRACT($$FMADD^XLFDT(DT,-30),1,5)_"01")
+14 SET START=$$ASKBEGIN^HLOUSR2(START)
+15 if 'START
QUIT
+16 SET END=$$ASKEND^HLOUSR2(START)
+17 if 'END
QUIT
+18 if TYPE="MONTHLY"
SET START=$EXTRACT(START,1,5)_"00"
+19 if TYPE="DAILY"
SET START=$EXTRACT(START,1,7)
+20 if TYPE="HOURLY"
SET START=$EXTRACT(START,1,10)
+21 if $$DEVICE()
DO PRINT(TYPE,START,END)
+22 QUIT
+23 ;
QUE ;entry point for queuing the message statistics report
+1 DO PRINT($GET(HLOPARMS("STATISTICS TYPE")),$GET(HLOPARMS("START DT/TM")),$GET(HLOPARMS("END DT/TM")))
+2 QUIT
+3 ;
PRINT(STATTYPE,START,END) ;
+1 ;
+2 NEW RAP,SAP,TIME,DIR,COUNT,PAGE,CRT,QUIT
+3 SET QUIT=0
+4 SET CRT=$SELECT($EXTRACT(IOST,1,2)="C-":1,1:0)
+5 ;
+6 USE IO
+7 if CRT
WRITE @IOF
+8 WRITE "HLO MESSAGE ERROR STATISTICS REPORT ",$$FMTE^XLFDT($$NOW^XLFDT),?70,"Page 1"
+9 DO LINE($$LJ("Type:",15)_STATTYPE)
+10 DO LINE($$LJ("Beginning:",15)_$SELECT(STATTYPE="MONTHLY":$$FMTE^XLFDT(START),1:$$FMTE^XLFDT(START)))
+11 DO LINE($$LJ("Ending:",15)_$$FMTE^XLFDT(END))
+12 SET PAGE=1
+13 ;
+14 ;
+15 FOR DIR="EIN","EOUT"
Begin DoDot:1
+16 NEW TOTAL
+17 SET TOTAL=0
+18 DO LINE(" ")
+19 SET TIME=START
+20 if STATTYPE="MONTHLY"
SET TIME=$EXTRACT(TIME,1,5)
+21 SET TIME=TIME-.0001
+22 DO LINE($SELECT(DIR="EIN":"INCOMING MESSAGES:",1:"OUTGOING MESSAGES:"))
+23 if QUIT
QUIT
+24 FOR
SET TIME=$ORDER(^HLSTATS(DIR,STATTYPE,TIME))
if ((TIME>$GET(END))&$GET(END))
QUIT
if 'TIME
QUIT
Begin DoDot:2
+25 NEW SUBTOTAL
+26 SET SUBTOTAL=0
+27 DO LINE(" ")
+28 if QUIT
QUIT
+29 DO LINE(" Time Period: "_$SELECT(STATTYPE="MONTHLY":$$FMTE^XLFDT(TIME_"00"),1:$$FMTE^XLFDT(TIME)))
+30 if QUIT
QUIT
+31 SET SAP=""
+32 FOR
SET SAP=$ORDER(^HLSTATS(DIR,STATTYPE,TIME,SAP))
if SAP=""
QUIT
Begin DoDot:3
+33 DO LINE(" Sending Application: "_SAP)
+34 if QUIT
QUIT
+35 SET RAP=""
+36 FOR
SET RAP=$ORDER(^HLSTATS(DIR,STATTYPE,TIME,SAP,RAP))
if RAP=""
QUIT
Begin DoDot:4
+37 DO LINE(" Receiving Application: "_RAP)
+38 if QUIT
QUIT
+39 SET TYPE=""
+40 FOR
SET TYPE=$ORDER(^HLSTATS(DIR,STATTYPE,TIME,SAP,RAP,TYPE))
if TYPE=""
QUIT
Begin DoDot:5
+41 SET COUNT=$GET(^HLSTATS(DIR,STATTYPE,TIME,SAP,RAP,TYPE))
+42 SET SUBTOTAL=SUBTOTAL+COUNT
+43 DO LINE(" Message Type: "_$$LJ(TYPE,25)_" Count:"_$$RJ(COUNT,10))
+44 if QUIT
QUIT
End DoDot:5
if QUIT
QUIT
End DoDot:4
if QUIT
QUIT
End DoDot:3
if QUIT
QUIT
+45 IF 'QUIT
Begin DoDot:3
+46 SET TOTAL=TOTAL+SUBTOTAL
+47 DO LINE(" ")
DO LINE($$RJ("**"_STATTYPE_" SUBTOTAL: ",68)_$$RJ(SUBTOTAL,10))
End DoDot:3
End DoDot:2
if QUIT
QUIT
+48 if 'QUIT
DO LINE(" ")
DO LINE($$RJ("** TOTAL "_$SELECT(DIR="EIN":"INCOMING",1:"OUTGOING")_" MESSAGE ERRORS: ",68)_$$RJ(TOTAL,10))
End DoDot:1
if QUIT
QUIT
+49 IF CRT
IF 'QUIT
DO PAUSE2
+50 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+51 DO ^%ZISC
+52 QUIT
+53 ;
DEVICE() ;
+1 ;Description: allows the user to select a device.
+2 ;Input: none
+3 ;
+4 ;Output:
+5 ; Function Value - Returns 0 if the user decides not to print or to
+6 ; queue the report, 1 otherwise.
+7 ;
+8 NEW OK,HLOPARMS
+9 SET OK=1
+10 SET %ZIS="MQ"
+11 DO ^%ZIS
+12 if POP
SET OK=0
+13 if OK&$DATA(IO("Q"))
Begin DoDot:1
+14 SET HLOPARMS("STATISTICS TYPE")=TYPE
SET HLOPARMS("START DT/TM")=START
SET HLOPARMS("END DT/TM")=END
+15 SET ZTRTN="QUE^HLOESTAT"
SET ZTDESC="HLO ERROR STATISTICS REPORT"
SET ZTSAVE("HLOPARMS(")=""
+16 DO ^%ZTLOAD
+17 WRITE !,$SELECT($DATA(ZTSK):"REQUEST QUEUED TASK="_ZTSK,1:"REQUEST CANCELLED")
+18 DO HOME^%ZIS
+19 SET OK=0
End DoDot:1
+20 QUIT OK
+21 ;
PAUSE ;
+1 ;First scrolls to the bottome of the page, then does a screen pause. Sets QUIT=1 if user decides to quit.
+2 ;
+3 NEW DIR,X,Y
+4 FOR
if $Y>(IOSL-3)
QUIT
WRITE !
+5 SET DIR(0)="E"
+6 DO ^DIR
+7 IF ('(+Y))!$DATA(DIRUT)
SET QUIT=1
+8 QUIT
PAUSE2 ;
+1 ;Screen pause without scrolling. Sets QUIT=1 if user decides to quit.
+2 ;
+3 NEW DIR,X,Y
+4 SET DIR(0)="E"
+5 DO ^DIR
+6 IF ('(+Y))!$DATA(DIRUT)
SET QUIT=1
+7 QUIT
+8 ;
LINE(LINE) ;Prints a line.
+1 ;
+2 IF CRT
IF ($Y>(IOSL-4))
Begin DoDot:1
+3 DO PAUSE
+4 if QUIT
QUIT
+5 WRITE @IOF
+6 WRITE LINE
End DoDot:1
+7 ;
+8 IF '$TEST
IF ('CRT)
IF ($Y>(IOSL-2))
Begin DoDot:1
+9 WRITE @IOF
+10 WRITE ?70,"Page: ",PAGE
+11 SET PAGE=PAGE+1
+12 WRITE LINE
End DoDot:1
+13 ;
+14 IF '$TEST
WRITE !,LINE
+15 QUIT
+16 ;
LJ(STRING,LEN) ;
+1 QUIT $$LJ^XLFSTR($EXTRACT(STRING,1,LEN),LEN)
RJ(STRING,LEN) ;
+1 QUIT $$RJ^XLFSTR($EXTRACT(STRING,1,LEN),LEN)