HLOSTAT ;ALB/CJM- HLO STATISTICS- 10/4/94 1pm
;;1.6;HEALTH LEVEL SEVEN;**130,131**;Oct 13, 1995;Build 10
;
;
COUNT(HLCSTATE,RAP,SAP,TYPE) ;
S:RAP="" RAP="UNKNOWN"
S:SAP="" SAP="UNKNOWN"
S:$L(TYPE)<2 TYPE="UNKNOWN"
S HLCSTATE("COUNTS")=$G(HLCSTATE("COUNTS"))+1,HLCSTATE("COUNTS",SAP,RAP,TYPE)=1+$G(HLCSTATE("COUNTS",SAP,RAP,TYPE))
Q
SAVECNTS(HLCSTATE) ;
N TIME,DIR,RAP,SAP,TYPE,COUNT
Q:'$G(HLCSTATE("COUNTS"))
S TIME=$E($$NOW^XLFDT,1,10)
S DIR=$S(+$G(HLCSTATE("SERVER")):"IN",1:"OUT")
I $G(HLCSTATE("COUNTS","ACKS")) D
.I $$INC^HLOSITE($NA(^HLSTATS($S(DIR="IN":"OUT",1:"IN"),"HOURLY",+TIME,"ACCEPT ACK")),HLCSTATE("COUNTS","ACKS"))
S SAP=""
F S SAP=$O(HLCSTATE("COUNTS",SAP)) Q:SAP="" D
.S RAP=""
.F S RAP=$O(HLCSTATE("COUNTS",SAP,RAP)) Q:RAP="" D
..S TYPE=""
..F S TYPE=$O(HLCSTATE("COUNTS",SAP,RAP,TYPE)) Q:TYPE="" D
...S COUNT=HLCSTATE("COUNTS",SAP,RAP,TYPE)
...I $$INC^HLOSITE($NA(^HLSTATS(DIR,"HOURLY",+TIME,SAP,RAP,TYPE)),COUNT)
K HLCSTATE("COUNTS") S HLCSTATE("COUNTS")=0
Q
;
TOTAL(WORK) ;totals hours into days and days into months
;
N RAP,SAP,TIME,LIMIT,DIR,COUNT,MONTH,START,END
;
;start totaling the next day after last date totaled
S START=$G(^HLSTATS("END DATE"))
S:START START=$$FMADD^XLFDT(START,1)
;
;end totaling in the last hour of yesterday and save it so that the next run knows where to start
S END=$$FMADD^XLFDT($$DT^XLFDT,-1)
S ^HLSTATS("END DATE")=END
S END=END+.24
;
;total hours into days
S LIMIT=$$FMADD^XLFDT($$DT^XLFDT,,-48) ;save ~48 hours of hourly data
F DIR="IN","OUT" D
.S TIME=0
.F S TIME=$O(^HLSTATS(DIR,"HOURLY",TIME)) Q:'TIME Q:(TIME>END) D
..D:'(TIME<START)
...S ^HLSTATS(DIR,"DAILY",$P(TIME,"."),"ACCEPT ACK")=$G(^HLSTATS(DIR,"DAILY",$P(TIME,"."),"ACCEPT ACK"))+$G(^HLSTATS(DIR,"HOURLY",TIME,"ACCEPT ACK"))
...S SAP=""
...F S SAP=$O(^HLSTATS(DIR,"HOURLY",TIME,SAP)) Q:SAP="" D
....S RAP=""
....F S RAP=$O(^HLSTATS(DIR,"HOURLY",TIME,SAP,RAP)) Q:RAP="" D
.....S TYPE=""
.....F S TYPE=$O(^HLSTATS(DIR,"HOURLY",TIME,SAP,RAP,TYPE)) Q:TYPE="" D
......S COUNT=$G(^HLSTATS(DIR,"HOURLY",TIME,SAP,RAP,TYPE))
......S ^HLSTATS(DIR,"DAILY",$P(TIME,"."),SAP,RAP,TYPE)=$G(^HLSTATS(DIR,"DAILY",$P(TIME,"."),SAP,RAP,TYPE))+COUNT
..;get rid of old hourly stats
..K:(TIME<LIMIT) ^HLSTATS(DIR,"HOURLY",TIME)
;
;total days into months
S LIMIT=$$FMADD^XLFDT($$DT^XLFDT,-30) ;save ~30 days of daily data
F DIR="IN","OUT" D
.S TIME=0
.F S TIME=$O(^HLSTATS(DIR,"DAILY",TIME)) Q:'TIME Q:(TIME>END) D
..D:'(TIME<START)
...S MONTH=$E(TIME,1,5)
...S ^HLSTATS(DIR,"MONTHLY",MONTH,"ACCEPT ACK")=$G(^HLSTATS(DIR,"MONTHLY",MONTH,"ACCEPT ACK"))+$G(^HLSTATS(DIR,"DAILY",TIME,"ACCEPT ACK"))
...S SAP=""
...F S SAP=$O(^HLSTATS(DIR,"DAILY",TIME,SAP)) Q:SAP="" D
....S RAP=""
....F S RAP=$O(^HLSTATS(DIR,"DAILY",TIME,SAP,RAP)) Q:RAP="" D
.....S TYPE=""
.....F S TYPE=$O(^HLSTATS(DIR,"DAILY",TIME,SAP,RAP,TYPE)) Q:TYPE="" D
......S COUNT=$G(^HLSTATS(DIR,"DAILY",TIME,SAP,RAP,TYPE))
......S ^HLSTATS(DIR,"MONTHLY",MONTH,SAP,RAP,TYPE)=$G(^HLSTATS(DIR,"MONTHLY",MONTH,SAP,RAP,TYPE))+COUNT
..K:(TIME<LIMIT) ^HLSTATS(DIR,"DAILY",TIME)
Q
REPORT ;Interactive option for printing the message statistics report
N DIR,TYPE,START,END
W !,"Hourly, daily, and monthly 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 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 MESSAGING 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="IN","OUT" 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="IN":"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 COUNT=$G(^HLSTATS(DIR,STATTYPE,TIME,"ACCEPT ACK"))
..I COUNT D Q:QUIT
...D LINE(" ")
...Q:QUIT
...D LINE(" Accept Acknowledgments by All Applications Count:"_$$RJ(COUNT,10))
...Q:QUIT
...D LINE(" ")
..S SAP=""
..F S SAP=$O(^HLSTATS(DIR,STATTYPE,TIME,SAP)) Q:SAP="" D Q:QUIT
...Q:SAP="ACCEPT ACK"
...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 ** (excluding commit acks):",68)_$$RJ(SUBTOTAL,10))
.D:'QUIT LINE(" "),LINE($$RJ("** TOTAL "_$S(DIR="IN":"INCOMING",1:"OUTGOING")_" MESSAGES ** (excluding commit acks):",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^HLOSTAT",ZTDESC="HLO MESSAGE 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)
HLOSTAT ;ALB/CJM- HLO STATISTICS- 10/4/94 1pm
+1 ;;1.6;HEALTH LEVEL SEVEN;**130,131**;Oct 13, 1995;Build 10
+2 ;
+3 ;
COUNT(HLCSTATE,RAP,SAP,TYPE) ;
+1 IF RAP=""
SET RAP="UNKNOWN"
+2 IF SAP=""
SET SAP="UNKNOWN"
+3 IF $LENGTH(TYPE)<2
SET TYPE="UNKNOWN"
+4 SET HLCSTATE("COUNTS")=$GET(HLCSTATE("COUNTS"))+1
SET HLCSTATE("COUNTS",SAP,RAP,TYPE)=1+$GET(HLCSTATE("COUNTS",SAP,RAP,TYPE))
+5 QUIT
SAVECNTS(HLCSTATE) ;
+1 NEW TIME,DIR,RAP,SAP,TYPE,COUNT
+2 IF '$GET(HLCSTATE("COUNTS"))
QUIT
+3 SET TIME=$EXTRACT($$NOW^XLFDT,1,10)
+4 SET DIR=$SELECT(+$GET(HLCSTATE("SERVER")):"IN",1:"OUT")
+5 IF $GET(HLCSTATE("COUNTS","ACKS"))
Begin DoDot:1
+6 IF $$INC^HLOSITE($NAME(^HLSTATS($SELECT(DIR="IN":"OUT",1:"IN"),"HOURLY",+TIME,"ACCEPT ACK")),HLCSTATE("COUNTS","ACKS"))
End DoDot:1
+7 SET SAP=""
+8 FOR
SET SAP=$ORDER(HLCSTATE("COUNTS",SAP))
IF SAP=""
QUIT
Begin DoDot:1
+9 SET RAP=""
+10 FOR
SET RAP=$ORDER(HLCSTATE("COUNTS",SAP,RAP))
IF RAP=""
QUIT
Begin DoDot:2
+11 SET TYPE=""
+12 FOR
SET TYPE=$ORDER(HLCSTATE("COUNTS",SAP,RAP,TYPE))
IF TYPE=""
QUIT
Begin DoDot:3
+13 SET COUNT=HLCSTATE("COUNTS",SAP,RAP,TYPE)
+14 IF $$INC^HLOSITE($NAME(^HLSTATS(DIR,"HOURLY",+TIME,SAP,RAP,TYPE)),COUNT)
End DoDot:3
End DoDot:2
End DoDot:1
+15 KILL HLCSTATE("COUNTS")
SET HLCSTATE("COUNTS")=0
+16 QUIT
+17 ;
TOTAL(WORK) ;totals hours into days and days into months
+1 ;
+2 NEW RAP,SAP,TIME,LIMIT,DIR,COUNT,MONTH,START,END
+3 ;
+4 ;start totaling the next day after last date totaled
+5 SET START=$GET(^HLSTATS("END DATE"))
+6 IF START
SET START=$$FMADD^XLFDT(START,1)
+7 ;
+8 ;end totaling in the last hour of yesterday and save it so that the next run knows where to start
+9 SET END=$$FMADD^XLFDT($$DT^XLFDT,-1)
+10 SET ^HLSTATS("END DATE")=END
+11 SET END=END+.24
+12 ;
+13 ;total hours into days
+14 ;save ~48 hours of hourly data
SET LIMIT=$$FMADD^XLFDT($$DT^XLFDT,,-48)
+15 FOR DIR="IN","OUT"
Begin DoDot:1
+16 SET TIME=0
+17 FOR
SET TIME=$ORDER(^HLSTATS(DIR,"HOURLY",TIME))
IF 'TIME
QUIT
IF (TIME>END)
QUIT
Begin DoDot:2
+18 IF '(TIME<START)
Begin DoDot:3
+19 SET ^HLSTATS(DIR,"DAILY",$PIECE(TIME,"."),"ACCEPT ACK")=$GET(^HLSTATS(DIR,"DAILY",$PIECE(TIME,"."),"ACCEPT ACK"))+$GET(^HLSTATS(DIR,"HOURLY",TIME,"ACCEPT ACK"))
+20 SET SAP=""
+21 FOR
SET SAP=$ORDER(^HLSTATS(DIR,"HOURLY",TIME,SAP))
IF SAP=""
QUIT
Begin DoDot:4
+22 SET RAP=""
+23 FOR
SET RAP=$ORDER(^HLSTATS(DIR,"HOURLY",TIME,SAP,RAP))
IF RAP=""
QUIT
Begin DoDot:5
+24 SET TYPE=""
+25 FOR
SET TYPE=$ORDER(^HLSTATS(DIR,"HOURLY",TIME,SAP,RAP,TYPE))
IF TYPE=""
QUIT
Begin DoDot:6
+26 SET COUNT=$GET(^HLSTATS(DIR,"HOURLY",TIME,SAP,RAP,TYPE))
+27 SET ^HLSTATS(DIR,"DAILY",$PIECE(TIME,"."),SAP,RAP,TYPE)=$GET(^HLSTATS(DIR,"DAILY",$PIECE(TIME,"."),SAP,RAP,TYPE))+COUNT
End DoDot:6
End DoDot:5
End DoDot:4
End DoDot:3
+28 ;get rid of old hourly stats
+29 IF (TIME<LIMIT)
KILL ^HLSTATS(DIR,"HOURLY",TIME)
End DoDot:2
End DoDot:1
+30 ;
+31 ;total days into months
+32 ;save ~30 days of daily data
SET LIMIT=$$FMADD^XLFDT($$DT^XLFDT,-30)
+33 FOR DIR="IN","OUT"
Begin DoDot:1
+34 SET TIME=0
+35 FOR
SET TIME=$ORDER(^HLSTATS(DIR,"DAILY",TIME))
IF 'TIME
QUIT
IF (TIME>END)
QUIT
Begin DoDot:2
+36 IF '(TIME<START)
Begin DoDot:3
+37 SET MONTH=$EXTRACT(TIME,1,5)
+38 SET ^HLSTATS(DIR,"MONTHLY",MONTH,"ACCEPT ACK")=$GET(^HLSTATS(DIR,"MONTHLY",MONTH,"ACCEPT ACK"))+$GET(^HLSTATS(DIR,"DAILY",TIME,"ACCEPT ACK"))
+39 SET SAP=""
+40 FOR
SET SAP=$ORDER(^HLSTATS(DIR,"DAILY",TIME,SAP))
IF SAP=""
QUIT
Begin DoDot:4
+41 SET RAP=""
+42 FOR
SET RAP=$ORDER(^HLSTATS(DIR,"DAILY",TIME,SAP,RAP))
IF RAP=""
QUIT
Begin DoDot:5
+43 SET TYPE=""
+44 FOR
SET TYPE=$ORDER(^HLSTATS(DIR,"DAILY",TIME,SAP,RAP,TYPE))
IF TYPE=""
QUIT
Begin DoDot:6
+45 SET COUNT=$GET(^HLSTATS(DIR,"DAILY",TIME,SAP,RAP,TYPE))
+46 SET ^HLSTATS(DIR,"MONTHLY",MONTH,SAP,RAP,TYPE)=$GET(^HLSTATS(DIR,"MONTHLY",MONTH,SAP,RAP,TYPE))+COUNT
End DoDot:6
End DoDot:5
End DoDot:4
End DoDot:3
+47 IF (TIME<LIMIT)
KILL ^HLSTATS(DIR,"DAILY",TIME)
End DoDot:2
End DoDot:1
+48 QUIT
REPORT ;Interactive option for printing the message statistics report
+1 NEW DIR,TYPE,START,END
+2 WRITE !,"Hourly, daily, and monthly 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 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 ;
+2 DO PRINT($GET(HLOPARMS("STATISTICS TYPE")),$GET(HLOPARMS("START DT/TM")),$GET(HLOPARMS("END DT/TM")))
+3 QUIT
+4 ;
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 MESSAGING 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="IN","OUT"
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="IN":"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 COUNT=$GET(^HLSTATS(DIR,STATTYPE,TIME,"ACCEPT ACK"))
+32 IF COUNT
Begin DoDot:3
+33 DO LINE(" ")
+34 IF QUIT
QUIT
+35 DO LINE(" Accept Acknowledgments by All Applications Count:"_$$RJ(COUNT,10))
+36 IF QUIT
QUIT
+37 DO LINE(" ")
End DoDot:3
IF QUIT
QUIT
+38 SET SAP=""
+39 FOR
SET SAP=$ORDER(^HLSTATS(DIR,STATTYPE,TIME,SAP))
IF SAP=""
QUIT
Begin DoDot:3
+40 IF SAP="ACCEPT ACK"
QUIT
+41 DO LINE(" Sending Application: "_SAP)
+42 IF QUIT
QUIT
+43 SET RAP=""
+44 FOR
SET RAP=$ORDER(^HLSTATS(DIR,STATTYPE,TIME,SAP,RAP))
IF RAP=""
QUIT
Begin DoDot:4
+45 DO LINE(" Receiving Application: "_RAP)
+46 IF QUIT
QUIT
+47 SET TYPE=""
+48 FOR
SET TYPE=$ORDER(^HLSTATS(DIR,STATTYPE,TIME,SAP,RAP,TYPE))
IF TYPE=""
QUIT
Begin DoDot:5
+49 SET COUNT=$GET(^HLSTATS(DIR,STATTYPE,TIME,SAP,RAP,TYPE))
+50 SET SUBTOTAL=SUBTOTAL+COUNT
+51 DO LINE(" Message Type: "_$$LJ(TYPE,25)_" Count:"_$$RJ(COUNT,10))
+52 IF QUIT
QUIT
End DoDot:5
IF QUIT
QUIT
End DoDot:4
IF QUIT
QUIT
End DoDot:3
IF QUIT
QUIT
+53 IF 'QUIT
Begin DoDot:3
+54 SET TOTAL=TOTAL+SUBTOTAL
+55 DO LINE(" ")
DO LINE($$RJ("**"_STATTYPE_" SUBTOTAL ** (excluding commit acks):",68)_$$RJ(SUBTOTAL,10))
End DoDot:3
End DoDot:2
IF QUIT
QUIT
+56 IF 'QUIT
DO LINE(" ")
DO LINE($$RJ("** TOTAL "_$SELECT(DIR="IN":"INCOMING",1:"OUTGOING")_" MESSAGES ** (excluding commit acks):",68)_$$RJ(TOTAL,10))
End DoDot:1
IF QUIT
QUIT
+57 IF CRT
IF 'QUIT
DO PAUSE2
+58 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+59 DO ^%ZISC
+60 QUIT
+61 ;
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^HLOSTAT"
SET ZTDESC="HLO MESSAGE 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)