INHRSE ; FRW,DP ; 16 May 96 11:15; Interface message size report
;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
;COPYRIGHT 1991-2000 SAIC
Q
EN ;main entry point
N INLOAD,INDES,INBEG,INEND,FLG,INDEST,INLN,GTOT,GTOTL,L,MSG,MSGDTTM,NONE,PAG,PCOUNT,PGTOT,PERF,SIZE,SUB,TM,TOT,TT,TT1,X,X1,X2,X3,X4,%DT,ACTZE,AVGCON,AVGMSG,BEG,CNT,CON,COUNT,D,DES,DIC,LOOP,LOOP1,DTTM,ZE
W @IOF Q:'$$PARM
; Device handling & Tasking logic
K IOP S %ZIS("A")="QUEUE ON DEVICE: ",%ZIS("B")="",%ZIS="NQ"
W ! D ^%ZIS G:POP QUIT
S:IOM<132 IOM=132 S IOP=ION_";"_IOST_";"_IOM_";"_IOSL
I IO=IO(0) S %ZIS="" D ^%ZIS I POP W *7,!,"Sorry, unable to find device..." G QUIT
I IO'=IO(0) S ZTDESC="Interface message size report",ZTIO=IOP,ZTRTN="ENQUE^INHRSE" D G QUIT
.S ZTSAVE("INLOAD")=INLOAD D ^%ZTLOAD
ENQUE ;Taskman entry point
K PERF,CREPERF S PERF="PERF",INDEST=0,FLG=0
S INBEG=$P(INLOAD,U),INEND=$P(INLOAD,U,2),INDES=$P(INLOAD,U,3)
I $L(INDES)>1 S INDEST=1 F I=1:1:$L(INDES,",")-1 S DES($P(INDES,",",I))=""
D COMP(.PERF,.CREPERF)
D SUM(.PERF)
D OUTPUT(.PERF)
;
QUIT ;Exit point
D ^%ZISC
Q
;
PARM() ;Get parameters
S DIC=4005,DIC(0)="AEMNQZ"
D DES Q:'Y Q:POP 0
S INBEG=0,INEND=0
Q:'$$GETRNG(.INBEG,.INEND,.INABEG,.INAEND) 0
S INLOAD=INBEG_U_INEND_U_INDES_U_INABEG_U_INAEND
Q 1
;
COMP(PERF,CREPERF) ;Compile statistics
;
;; PERF - message array.
;; CREPERF - control array.
;
S BEG=INBEG-.000001
I $P(IOST,"-")["C",IO=IO(0) W !,"Compiling data "
F CNT=0:1 S BEG=$O(^INTHU("B",BEG)) Q:BEG=""!(BEG>INEND) D
.I $P(IOST,"-")["C",IO=IO(0) W:'(CNT#1000) "."
.S LOOP="" F S LOOP=$O(^INTHU("B",BEG,LOOP)) Q:LOOP="" D
.. ;Check destination
.. S ZE=$G(^INTHU(LOOP,0))
.. S DES=$P(ZE,U,2) S:DES="" DES="NULL"
.. ;Determine transaction type
.. I INDEST Q:'$D(DES(DES))
.. S TT=$P(ZE,U,11)
.. S TT1=$P($G(^INRHT(+TT,0)),U) S:TT1="" TT1="NULL"
.. S:'TT TT=DES_U_"D" I 'TT S TT="NULL"
.. I TT["D",+DES S TT1=$P($G(^INRHD(DES,0)),U)
.. S MSGDTTM=+$E($P(ZE,U,1),1,10)
.. S SIZE=$$SIZE(LOOP)
.. ;check for empty messages
.. S:'SIZE PERF(TT1,TT,2)=$G(PERF(TT1,TT,2))+1
.. S PERF(TT1,TT)=$G(PERF(TT1,TT))+1
.. S PERF(TT1,TT,1)=$G(PERF(TT1,TT,1))+SIZE
.. S PERF(TT1,TT,3)=$G(PERF(TT1,TT,3))+$P(SIZE,U,2)
Q
;
SIZE(LOOP) ;Get size of message
Q:'$G(LOOP) 0 N ACT,SZ,MSGSZ,DA
S ACT="^INTHU("_LOOP_")",MSGSZ=0,SZ=0
F S ACT=$Q(@ACT) Q:$$QS^INHUTIL(ACT,1)'=LOOP D
. S SUB=$$QS^INHUTIL(ACT,2),DA=$G(@ACT),ACTZE=$L(DA)
. I SUB=3 S SZ=SZ+ACTZE Q
. S MSGSZ=MSGSZ+ACTZE
Q SZ_U_MSGSZ
;
SUM(BREF,LEVEL) ;summarize array data
K TOT S LOOP=""
F X=0:1:3 S TOT(X)=0
F S LOOP=$O(PERF(LOOP)) Q:LOOP="" S LOOP1="" D
.F S LOOP1=$O(PERF(LOOP,LOOP1)) Q:LOOP1="" D
.. S TOT(0)=$G(PERF(LOOP,LOOP1))+TOT(0)
.. F I=1:1:3 S TOT(I)=$G(PERF(LOOP,LOOP1,I))+TOT(I)
Q
;
OUTPUT(BREF) ;Output data
;INRHD - .02 - 4005 TT pointer
;MSGSZ & CTLRSZ SHOW PERCENT OF TOTAL
S U1="%",PAG=1,TM=$$CDATASC^%ZTFDT($H,3,1) D SHDR
S DTTM="",GTOTL=(TOT(1)+TOT(3))/1000,POP=0
; set tabs
S L(1)=49,L(2)=57,L(3)=65,L(4)=71,L(5)=81,L(6)=88,L(7)=95
F S DTTM=$O(@BREF@(DTTM)) Q:DTTM=""!POP S TT="" D
. F S TT=$O(@BREF@(DTTM,TT)) Q:TT=""!POP D
.. S CON=$G(@BREF@(DTTM,TT,3)),MSG=$G(@BREF@(DTTM,TT,1))
.. S NONE=$G(@BREF@(DTTM,TT,2)),COUNT=$G(@BREF@(DTTM,TT))
.. S:'COUNT COUNT=.000001
.. S (AVGCON,AVGMSG)="*"
.. I COUNT>0 S AVGCON=$J((CON+MSG)/COUNT,0,0),AVGMSG=$J(MSG/COUNT,0,0)
.. W !!,$E(DTTM,1,40)
.. W ?L(1)-$L(AVGCON),AVGCON,?L(2)-$L(AVGMSG),AVGMSG
.. W ?L(3)-$L($J(CON/COUNT,0,0)),$J(CON/COUNT,0,0)
.. W ?L(4)-$L(COUNT),COUNT
.. S GTOT=CON+MSG,CON=$J(CON/1000,0,0),MSG=$J(MSG/1000,0,0)
.. S GTOT=$J(GTOT/1000,0,0)
.. ;
.. ; calculate percentage ot total count
.. S (PCOUNT,PGTOT)="*"
.. I TOT(0)>0 S PCOUNT=$J(COUNT/TOT(0)*100,0,0)
.. I GTOTL>0 S PGTOT=$J(GTOT/GTOTL*100,0,0)
.. W ?L(5)-$L(GTOT),GTOT,?L(6)-$L(MSG),MSG,?L(7)-$L(CON),CON
.. W !?L(4)-$L(PCOUNT),PCOUNT,U1,?L(5)-$L(PGTOT),PGTOT,U1
.. S X="*" I GTOT>0 S X=$J(MSG/GTOT*100,0,0)
.. W ?L(6)-$L(X),X,U1
.. S X="*" I GTOT>0 S X=$J(CON/GTOT*100,0,0)
.. W ?L(7)-$L(X),X,U1
.. I $Y>(IOSL-6),$P(IOST,"-")["P" D HDR Q
.. D:$Y>(IOSL-2) HDR
;
; display totals
Q:POP
N X S X="--------------------"
I TOT(0)<1 D END Q
I TOT(0)>0 D
.S X(1)=$J((TOT(1)+TOT(3))/TOT(0),0,0)
.S X(2)=$J(TOT(1)/TOT(0),0,0)
.S X(3)=$J(TOT(3)/TOT(0),0,0)
S X(4)=TOT(0)
S X(5)=$J((TOT(1)+TOT(3))/1000,0,0)
S X(6)=$J(TOT(1)/1000,0,0)
S X(7)=$J(TOT(3)/1000,0,0)
W ! F I=1:1:7 W ?L(I)-$L(X(I)),$E(X,1,$L(X(I)))
W !,"TOTAL" F I=1:1:7 W ?L(I)-$L(X(I)),X(I)
P ; print text
S FLG=1 D:$Y+17>IOSL HDR Q:POP
W !!!! F I=1:1:13 S X=$P($T(TEXT+I),";;",2) D
.I $L(X)<IOM W !,X Q
.S X1=X F A=$L(X," "):-1 S X=$P(X1," ",1,A) I $L(X)<IOM S X1=$P(X1," ",A+1,99) Q
.W !,X,!?13,X1
END ;I IO=$P,'POP S X=$$CR^UTSRD
I IO=IO(0),$E(IOST)'="P" S X=$$CR^UTSRD
W !! S X="*** End of Report ***" W !?IOM-$L(X)\2,X
W @IOF
Q
;
GETRNG(START,STOP,INABEG,INAEND) ;
;get starting and ending dates
;
N X,Y S START=1,STOP=999999999,INABEG=0
W ! Q:'$$IEN(.START,"Starting Date: ") 0
S INBEG=Y W !
S Y=$O(^INTHU("B",Y),-1) S:Y INABEG=$O(^INTHU("B",Y,""))
Q:'$$IEN(.STOP,"Ending Date: ") 0
S INEND=Y,X=$O(^INTHU("B",INEND,""))
S:INEND'["." INEND=INEND_".24"
;calculate the approximate number of record to be proccesed
S Y=INEND+.000001
S Y=$O(^INTHU("B",Y),-1)
S INAEND=$O(^INTHU("B",Y,999999999999),-1)
W !!,"Approximately ",INAEND-INABEG," Records will be processed"
Q 1
;
IEN(IEN,ASK) ;
;
S %DT="TAEX",%DT("A")=$G(ASK) D ^%DT Q:Y<1 0
S IEN=$Q(^INTHU("B",Y,0))
I $$QS^INHUTIL(IEN,1)'="B" S IEN="^INTHU(""B"",3000101,9999999999999)"
S IEN=$$QS^INHUTIL(IEN,2)
Q IEN
;
DES ;Get multiple destinations
N I S POP=0,INDES=""
F I=1:1 D Q:POP W:Y=-1&(INDES="") "ALL" Q:Y=-1
.D ^DIC S:X[U POP=1 Q:POP Q:(+Y)<1
.S INDES=INDES_(+Y)_","
Q
TEXT ;
;;Count - Total number of Tansaction within a Tansaction type.
;;Average (Bytes) - All averages are calculated in Bytes (characters).
;; TotSize - Total message size + Total control size / count.
;; MsgSize - Total Bytes in a message / count
;; CtlSize - Total Bytes in the control / count.
;;Totals (KBytes) - Totals are represented in KBytes (Byte/1000).
;; TotSize - Total number of KBytes in a transaction type.
;; MsgSz - Total number of KBytes in a message section.
;; CtlSz - Total number of KBytes in a control section.
;; %ofTot - Percentage of the transaction type count of the total report count (Count / Total Count).
;; %GTot - Percentage of total transaction type size out of total report (TotSize / Grand TotSize).
;; %TotM - Percentage of the total message size out of TotSize (Totm/Gtot).
;; %TotC - Percentage of total control size out of TotSize (TotC/Gtot).
Q
SHDR ;set header
S X=$$CDATASC^%ZTFDT($H,1,1),INLN(0)=X_" Page "
S INLN(1)="Interface message size report"
S X="From: "_$$CDATASC^%ZTFDT($E(INBEG,1,10),3,1)
S INLN(2)=X_" To: "_$$CDATASC^%ZTFDT($E(INEND,1,10),3,1)
;get the site name
S INLN(6)=$S($D(^DIC(4,^DD("SITE",1),0)):^(0),1:^DD("SITE"))
S INLN(6)=$S($P(INLN(6),U,4)]"":$P(INLN(6),U,4),1:$P(INLN(6),U,1))
S INLN="",$P(INLN,"-",IOM+1)=""
;
HDR ;Print header
I $P(IOST,"-")["C",IO=IO(0) S X=$$CR^UTSRD I X S POP=1 Q
I PAG>1!($P(IOST,"-")["C") W @IOF
W !,INLN(6)
S X=INLN(0)_PAG,PAG=PAG+1
W ?IOM-$L(X)-1,X,!
F I=1,2 W !?IOM-$L(INLN(I))\2,INLN(I)
Q:FLG W !!,"Destination: " D
.I 'INDES W "All" Q
.S D="" F S D=$O(DES(D)) Q:D="" W ?14,$P(^INRHD(D,0),U),!
W !,INLN,!?42,"----Average(Bytes)----",?75,"---Totals (KBytes)---"
W !,"Transaction Type"
W ?42,"TotSize MsgSize CtlSize Count"
W ?75,"TotSize MsgSz CtlSz"
W !?67,"%ofTot %GTot %TotM %TotC",!,INLN
Q
INHRSE ; FRW,DP ; 16 May 96 11:15; Interface message size report
+1 ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
+2 ;COPYRIGHT 1991-2000 SAIC
+3 QUIT
EN ;main entry point
+1 NEW INLOAD,INDES,INBEG,INEND,FLG,INDEST,INLN,GTOT,GTOTL,L,MSG,MSGDTTM,NONE,PAG,PCOUNT,PGTOT,PERF,SIZE,SUB,TM,TOT,TT,TT1,X,X1,X2,X3,X4,%DT,ACTZE,AVGCON,AVGMSG,BEG,CNT,CON,COUNT,D,DES,DIC,LOOP,LOOP1,DTTM,ZE
+2 WRITE @IOF
IF '$$PARM
QUIT
+3 ; Device handling & Tasking logic
+4 KILL IOP
SET %ZIS("A")="QUEUE ON DEVICE: "
SET %ZIS("B")=""
SET %ZIS="NQ"
+5 WRITE !
DO ^%ZIS
IF POP
GOTO QUIT
+6 IF IOM<132
SET IOM=132
SET IOP=ION_";"_IOST_";"_IOM_";"_IOSL
+7 IF IO=IO(0)
SET %ZIS=""
DO ^%ZIS
IF POP
WRITE *7,!,"Sorry, unable to find device..."
GOTO QUIT
+8 IF IO'=IO(0)
SET ZTDESC="Interface message size report"
SET ZTIO=IOP
SET ZTRTN="ENQUE^INHRSE"
Begin DoDot:1
+9 SET ZTSAVE("INLOAD")=INLOAD
DO ^%ZTLOAD
End DoDot:1
GOTO QUIT
ENQUE ;Taskman entry point
+1 KILL PERF,CREPERF
SET PERF="PERF"
SET INDEST=0
SET FLG=0
+2 SET INBEG=$PIECE(INLOAD,U)
SET INEND=$PIECE(INLOAD,U,2)
SET INDES=$PIECE(INLOAD,U,3)
+3 IF $LENGTH(INDES)>1
SET INDEST=1
FOR I=1:1:$LENGTH(INDES,",")-1
SET DES($PIECE(INDES,",",I))=""
+4 DO COMP(.PERF,.CREPERF)
+5 DO SUM(.PERF)
+6 DO OUTPUT(.PERF)
+7 ;
QUIT ;Exit point
+1 DO ^%ZISC
+2 QUIT
+3 ;
PARM() ;Get parameters
+1 SET DIC=4005
SET DIC(0)="AEMNQZ"
+2 DO DES
IF 'Y
QUIT
IF POP
QUIT 0
+3 SET INBEG=0
SET INEND=0
+4 IF '$$GETRNG(.INBEG,.INEND,.INABEG,.INAEND)
QUIT 0
+5 SET INLOAD=INBEG_U_INEND_U_INDES_U_INABEG_U_INAEND
+6 QUIT 1
+7 ;
COMP(PERF,CREPERF) ;Compile statistics
+1 ;
+2 ;; PERF - message array.
+3 ;; CREPERF - control array.
+4 ;
+5 SET BEG=INBEG-.000001
+6 IF $PIECE(IOST,"-")["C"
IF IO=IO(0)
WRITE !,"Compiling data "
+7 FOR CNT=0:1
SET BEG=$ORDER(^INTHU("B",BEG))
IF BEG=""!(BEG>INEND)
QUIT
Begin DoDot:1
+8 IF $PIECE(IOST,"-")["C"
IF IO=IO(0)
IF '(CNT#1000)
WRITE "."
+9 SET LOOP=""
FOR
SET LOOP=$ORDER(^INTHU("B",BEG,LOOP))
IF LOOP=""
QUIT
Begin DoDot:2
+10 ;Check destination
+11 SET ZE=$GET(^INTHU(LOOP,0))
+12 SET DES=$PIECE(ZE,U,2)
IF DES=""
SET DES="NULL"
+13 ;Determine transaction type
+14 IF INDEST
IF '$DATA(DES(DES))
QUIT
+15 SET TT=$PIECE(ZE,U,11)
+16 SET TT1=$PIECE($GET(^INRHT(+TT,0)),U)
IF TT1=""
SET TT1="NULL"
+17 IF 'TT
SET TT=DES_U_"D"
IF 'TT
SET TT="NULL"
+18 IF TT["D"
IF +DES
SET TT1=$PIECE($GET(^INRHD(DES,0)),U)
+19 SET MSGDTTM=+$EXTRACT($PIECE(ZE,U,1),1,10)
+20 SET SIZE=$$SIZE(LOOP)
+21 ;check for empty messages
+22 IF 'SIZE
SET PERF(TT1,TT,2)=$GET(PERF(TT1,TT,2))+1
+23 SET PERF(TT1,TT)=$GET(PERF(TT1,TT))+1
+24 SET PERF(TT1,TT,1)=$GET(PERF(TT1,TT,1))+SIZE
+25 SET PERF(TT1,TT,3)=$GET(PERF(TT1,TT,3))+$PIECE(SIZE,U,2)
End DoDot:2
End DoDot:1
+26 QUIT
+27 ;
SIZE(LOOP) ;Get size of message
+1 IF '$GET(LOOP)
QUIT 0
NEW ACT,SZ,MSGSZ,DA
+2 SET ACT="^INTHU("_LOOP_")"
SET MSGSZ=0
SET SZ=0
+3 FOR
SET ACT=$QUERY(@ACT)
IF $$QS^INHUTIL(ACT,1)'=LOOP
QUIT
Begin DoDot:1
+4 SET SUB=$$QS^INHUTIL(ACT,2)
SET DA=$GET(@ACT)
SET ACTZE=$LENGTH(DA)
+5 IF SUB=3
SET SZ=SZ+ACTZE
QUIT
+6 SET MSGSZ=MSGSZ+ACTZE
End DoDot:1
+7 QUIT SZ_U_MSGSZ
+8 ;
SUM(BREF,LEVEL) ;summarize array data
+1 KILL TOT
SET LOOP=""
+2 FOR X=0:1:3
SET TOT(X)=0
+3 FOR
SET LOOP=$ORDER(PERF(LOOP))
IF LOOP=""
QUIT
SET LOOP1=""
Begin DoDot:1
+4 FOR
SET LOOP1=$ORDER(PERF(LOOP,LOOP1))
IF LOOP1=""
QUIT
Begin DoDot:2
+5 SET TOT(0)=$GET(PERF(LOOP,LOOP1))+TOT(0)
+6 FOR I=1:1:3
SET TOT(I)=$GET(PERF(LOOP,LOOP1,I))+TOT(I)
End DoDot:2
End DoDot:1
+7 QUIT
+8 ;
OUTPUT(BREF) ;Output data
+1 ;INRHD - .02 - 4005 TT pointer
+2 ;MSGSZ & CTLRSZ SHOW PERCENT OF TOTAL
+3 SET U1="%"
SET PAG=1
SET TM=$$CDATASC^%ZTFDT($HOROLOG,3,1)
DO SHDR
+4 SET DTTM=""
SET GTOTL=(TOT(1)+TOT(3))/1000
SET POP=0
+5 ; set tabs
+6 SET L(1)=49
SET L(2)=57
SET L(3)=65
SET L(4)=71
SET L(5)=81
SET L(6)=88
SET L(7)=95
+7 FOR
SET DTTM=$ORDER(@BREF@(DTTM))
IF DTTM=""!POP
QUIT
SET TT=""
Begin DoDot:1
+8 FOR
SET TT=$ORDER(@BREF@(DTTM,TT))
IF TT=""!POP
QUIT
Begin DoDot:2
+9 SET CON=$GET(@BREF@(DTTM,TT,3))
SET MSG=$GET(@BREF@(DTTM,TT,1))
+10 SET NONE=$GET(@BREF@(DTTM,TT,2))
SET COUNT=$GET(@BREF@(DTTM,TT))
+11 IF 'COUNT
SET COUNT=.000001
+12 SET (AVGCON,AVGMSG)="*"
+13 IF COUNT>0
SET AVGCON=$JUSTIFY((CON+MSG)/COUNT,0,0)
SET AVGMSG=$JUSTIFY(MSG/COUNT,0,0)
+14 WRITE !!,$EXTRACT(DTTM,1,40)
+15 WRITE ?L(1)-$LENGTH(AVGCON),AVGCON,?L(2)-$LENGTH(AVGMSG),AVGMSG
+16 WRITE ?L(3)-$LENGTH($JUSTIFY(CON/COUNT,0,0)),$JUSTIFY(CON/COUNT,0,0)
+17 WRITE ?L(4)-$LENGTH(COUNT),COUNT
+18 SET GTOT=CON+MSG
SET CON=$JUSTIFY(CON/1000,0,0)
SET MSG=$JUSTIFY(MSG/1000,0,0)
+19 SET GTOT=$JUSTIFY(GTOT/1000,0,0)
+20 ;
+21 ; calculate percentage ot total count
+22 SET (PCOUNT,PGTOT)="*"
+23 IF TOT(0)>0
SET PCOUNT=$JUSTIFY(COUNT/TOT(0)*100,0,0)
+24 IF GTOTL>0
SET PGTOT=$JUSTIFY(GTOT/GTOTL*100,0,0)
+25 WRITE ?L(5)-$LENGTH(GTOT),GTOT,?L(6)-$LENGTH(MSG),MSG,?L(7)-$LENGTH(CON),CON
+26 WRITE !?L(4)-$LENGTH(PCOUNT),PCOUNT,U1,?L(5)-$LENGTH(PGTOT),PGTOT,U1
+27 SET X="*"
IF GTOT>0
SET X=$JUSTIFY(MSG/GTOT*100,0,0)
+28 WRITE ?L(6)-$LENGTH(X),X,U1
+29 SET X="*"
IF GTOT>0
SET X=$JUSTIFY(CON/GTOT*100,0,0)
+30 WRITE ?L(7)-$LENGTH(X),X,U1
+31 IF $Y>(IOSL-6)
IF $PIECE(IOST,"-")["P"
DO HDR
QUIT
+32 IF $Y>(IOSL-2)
DO HDR
End DoDot:2
End DoDot:1
+33 ;
+34 ; display totals
+35 IF POP
QUIT
+36 NEW X
SET X="--------------------"
+37 IF TOT(0)<1
DO END
QUIT
+38 IF TOT(0)>0
Begin DoDot:1
+39 SET X(1)=$JUSTIFY((TOT(1)+TOT(3))/TOT(0),0,0)
+40 SET X(2)=$JUSTIFY(TOT(1)/TOT(0),0,0)
+41 SET X(3)=$JUSTIFY(TOT(3)/TOT(0),0,0)
End DoDot:1
+42 SET X(4)=TOT(0)
+43 SET X(5)=$JUSTIFY((TOT(1)+TOT(3))/1000,0,0)
+44 SET X(6)=$JUSTIFY(TOT(1)/1000,0,0)
+45 SET X(7)=$JUSTIFY(TOT(3)/1000,0,0)
+46 WRITE !
FOR I=1:1:7
WRITE ?L(I)-$LENGTH(X(I)),$EXTRACT(X,1,$LENGTH(X(I)))
+47 WRITE !,"TOTAL"
FOR I=1:1:7
WRITE ?L(I)-$LENGTH(X(I)),X(I)
P ; print text
+1 SET FLG=1
IF $Y+17>IOSL
DO HDR
IF POP
QUIT
+2 WRITE !!!!
FOR I=1:1:13
SET X=$PIECE($TEXT(TEXT+I),";;",2)
Begin DoDot:1
+3 IF $LENGTH(X)<IOM
WRITE !,X
QUIT
+4 SET X1=X
FOR A=$LENGTH(X," "):-1
SET X=$PIECE(X1," ",1,A)
IF $LENGTH(X)<IOM
SET X1=$PIECE(X1," ",A+1,99)
QUIT
+5 WRITE !,X,!?13,X1
End DoDot:1
END ;I IO=$P,'POP S X=$$CR^UTSRD
+1 IF IO=IO(0)
IF $EXTRACT(IOST)'="P"
SET X=$$CR^UTSRD
+2 WRITE !!
SET X="*** End of Report ***"
WRITE !?IOM-$LENGTH(X)\2,X
+3 WRITE @IOF
+4 QUIT
+5 ;
GETRNG(START,STOP,INABEG,INAEND) ;
+1 ;get starting and ending dates
+2 ;
+3 NEW X,Y
SET START=1
SET STOP=999999999
SET INABEG=0
+4 WRITE !
IF '$$IEN(.START,"Starting Date
QUIT 0
+5 SET INBEG=Y
WRITE !
+6 SET Y=$ORDER(^INTHU("B",Y),-1)
IF Y
SET INABEG=$ORDER(^INTHU("B",Y,""))
+7 IF '$$IEN(.STOP,"Ending Date
QUIT 0
+8 SET INEND=Y
SET X=$ORDER(^INTHU("B",INEND,""))
+9 IF INEND'["."
SET INEND=INEND_".24"
+10 ;calculate the approximate number of record to be proccesed
+11 SET Y=INEND+.000001
+12 SET Y=$ORDER(^INTHU("B",Y),-1)
+13 SET INAEND=$ORDER(^INTHU("B",Y,999999999999),-1)
+14 WRITE !!,"Approximately ",INAEND-INABEG," Records will be processed"
+15 QUIT 1
+16 ;
IEN(IEN,ASK) ;
+1 ;
+2 SET %DT="TAEX"
SET %DT("A")=$GET(ASK)
DO ^%DT
IF Y<1
QUIT 0
+3 SET IEN=$QUERY(^INTHU("B",Y,0))
+4 IF $$QS^INHUTIL(IEN,1)'="B"
SET IEN="^INTHU(""B"",3000101,9999999999999)"
+5 SET IEN=$$QS^INHUTIL(IEN,2)
+6 QUIT IEN
+7 ;
DES ;Get multiple destinations
+1 NEW I
SET POP=0
SET INDES=""
+2 FOR I=1:1
Begin DoDot:1
+3 DO ^DIC
IF X[U
SET POP=1
IF POP
QUIT
IF (+Y)<1
QUIT
+4 SET INDES=INDES_(+Y)_","
End DoDot:1
IF POP
QUIT
IF Y=-1&(INDES="")
WRITE "ALL"
IF Y=-1
QUIT
+5 QUIT
TEXT ;
+1 ;;Count - Total number of Tansaction within a Tansaction type.
+2 ;;Average (Bytes) - All averages are calculated in Bytes (characters).
+3 ;; TotSize - Total message size + Total control size / count.
+4 ;; MsgSize - Total Bytes in a message / count
+5 ;; CtlSize - Total Bytes in the control / count.
+6 ;;Totals (KBytes) - Totals are represented in KBytes (Byte/1000).
+7 ;; TotSize - Total number of KBytes in a transaction type.
+8 ;; MsgSz - Total number of KBytes in a message section.
+9 ;; CtlSz - Total number of KBytes in a control section.
+10 ;; %ofTot - Percentage of the transaction type count of the total report count (Count / Total Count).
+11 ;; %GTot - Percentage of total transaction type size out of total report (TotSize / Grand TotSize).
+12 ;; %TotM - Percentage of the total message size out of TotSize (Totm/Gtot).
+13 ;; %TotC - Percentage of total control size out of TotSize (TotC/Gtot).
+14 QUIT
SHDR ;set header
+1 SET X=$$CDATASC^%ZTFDT($HOROLOG,1,1)
SET INLN(0)=X_" Page "
+2 SET INLN(1)="Interface message size report"
+3 SET X="From: "_$$CDATASC^%ZTFDT($EXTRACT(INBEG,1,10),3,1)
+4 SET INLN(2)=X_" To: "_$$CDATASC^%ZTFDT($EXTRACT(INEND,1,10),3,1)
+5 ;get the site name
+6 SET INLN(6)=$SELECT($DATA(^DIC(4,^DD("SITE",1),0)):^(0),1:^DD("SITE"))
+7 SET INLN(6)=$SELECT($PIECE(INLN(6),U,4)]"":$PIECE(INLN(6),U,4),1:$PIECE(INLN(6),U,1))
+8 SET INLN=""
SET $PIECE(INLN,"-",IOM+1)=""
+9 ;
HDR ;Print header
+1 IF $PIECE(IOST,"-")["C"
IF IO=IO(0)
SET X=$$CR^UTSRD
IF X
SET POP=1
QUIT
+2 IF PAG>1!($PIECE(IOST,"-")["C")
WRITE @IOF
+3 WRITE !,INLN(6)
+4 SET X=INLN(0)_PAG
SET PAG=PAG+1
+5 WRITE ?IOM-$LENGTH(X)-1,X,!
+6 FOR I=1,2
WRITE !?IOM-$LENGTH(INLN(I))\2,INLN(I)
+7 IF FLG
QUIT
WRITE !!,"Destination: "
Begin DoDot:1
+8 IF 'INDES
WRITE "All"
QUIT
+9 SET D=""
FOR
SET D=$ORDER(DES(D))
IF D=""
QUIT
WRITE ?14,$PIECE(^INRHD(D,0),U),!
End DoDot:1
+10 WRITE !,INLN,!?42,"----Average(Bytes)----",?75,"---Totals (KBytes)---"
+11 WRITE !,"Transaction Type"
+12 WRITE ?42,"TotSize MsgSize CtlSize Count"
+13 WRITE ?75,"TotSize MsgSz CtlSz"
+14 WRITE !?67,"%ofTot %GTot %TotM %TotC",!,INLN
+15 QUIT