INHVTMT3 ; KAC ; 04 Nov 1999 15:32 ; Multi-threaded TCP/IP socket utilities
;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
;COPYRIGHT 1991-2000 SAIC
Q
;
GETFRAME(INBFR,INFRMCHR,INFRMPOS) ; Create array of framing char positions
; in INBFR. E.g. INFRMPOS(5)=SOM, INFRMPOS(29)=SOM, INFRMPOS(134)=SOM
;
; Called by: RECEIVE^INHVTMT2
;
; Input:
; INBFR - (req) Buffer read by %INET (up to 512 bytes long)
; INFRMCHR - (req) Framing char(s) to search for
;
; Output:
; INFRMPOS - (pbr) Array of framing chars in INBFR by position
;
N INFOUND
S INFOUND=0
F D Q:'INFOUND
. S INFOUND=$F(INBFR,INFRMCHR,INFOUND)
. Q:'INFOUND
. S INFRMPOS(INFOUND-$L(INFRMCHR))=INFRMCHR
Q
;
PUTINREC(INMSG) ; Put msg (may only be a piece of msg) into INREC array
; Remove msg framing chars from msg portion and decrypt.
;
; Called by: RECEIVE^INHVTMT2
;
N X,INCLRHDR,INLAST,INMSGHDR,INTYPE
S INLAST=$S(INMSG[INEOM:1,1:0)
S:INMSG[INSOM INMSG=$E(INMSG,$F(INMSG,INSOM),$L(INMSG)) ; remove SOM
S:INLAST INMSG=$TR(INMSG,INEOM) ; remove EOM
; PDTS requires that ER & SE msg type be sent to CHCS unencrypted
; Check TYPE in msg hdr
I INSTD="PDTS",'$G(INCLRMSG),(INMSG[INSOD) D
. S X="" F S X=$O(@INREC@(X)) Q:'X S INMSGHDR=$G(INMSGHDR)_@INREC@(X)
. S INMSGHDR=$G(INMSGHDR)_$P(INMSG,INSOD)
. S INCLRMSG="^ER^SE^"[(U_$E(INMSGHDR,3,4)_U)
I INSTD="PDTS",'$G(INCLRMSG) S INCLRHDR=$S((INMSG[INSOD):1,(INRSTATE="SOD"):1,1:0)
I $D(INSOD),(INMSG[INSOD) S INMSG=$TR(INMSG,INSOD,INEOL) ; grp separator
;
; Decrypt all except 1st hdr (E.g. SOM-ENP Hdr Data-EOL) and EOM char
I $L(INMSG),'$G(INCLRMSG) D
. I $G(INCLRHDR) D ; do NOT decrypt any part of 1st hdr
.. S INMSGHDR=$P(INMSG,INEOL)_$S(INMSG[INEOL:INEOL,1:"")
..; decrypt after 1st hdr
.. S INMSG=$P(INMSG,INEOL,2,99999)
. I $L(INMSG) D
..; if partial IV at start of encrypted msg, save til have full IV
.. I INFIRST,(($L(INIVBLD)+$L(INMSG))<INIVLEN) S INIVBLD=INIVBLD_INMSG,INMSG="" Q
.. I $L(INIVBLD) D S INIVBLD=""
... I ($L(INIVBLD)+$L(INMSG))'>512 S INMSG=INIVBLD_INMSG Q
... S INIVBLD=INIVBLD_$E(INMSG,1,INIVLEN)
... S INMSG=$E(INMSG,INIVLEN+1,99999)
... D DECRYPT^INCRYPT(.INIVBLD,.X,$L(INIVBLD),INFIRST,0)
... S INIVBLD=X,INFIRST=0
... D STORE(INIVBLD)
..;
.. D DECRYPT^INCRYPT(.INMSG,.X,$L(INMSG),INFIRST,INLAST)
.. S INMSG=X,INFIRST=$S(INLAST:1,1:0)
.;
. S:$G(INCLRHDR) INMSG=INMSGHDR_INMSG
;
S:INLAST INCLRMSG='$G(INIP("CRYPT"))
D STORE(INMSG)
Q
;
STORE(INMSG) ; Store decrypted msg in INREC
Q:'$L(INMSG)
S:$D(INFS) INMSG=$TR(INMSG,INFS,INDELIM) ; transform field separator
; Ck $Storage for rollover to global
I $S<INSMIN D
.Q:INREC["^"
.K ^UTILITY("INREC",$J)
.M ^UTILITY("INREC",$J)=@INREC K @INREC S INREC="^UTILITY(""INREC"","_$J_")"
;
S INRECCNT=INRECCNT+1,@INREC@(INRECCNT)=INMSG
Q
;
EVAL(ING) ; Evaluate incoming response. Msg is marked complete
; when o/p ctlr runs inbound script.
;
; Called by: RECEIVE^INHVTMT2
;
; Input:
; ING - (req) Array in which decrypted, parsed msg is stored.
;
N INERR,INERRHU,INMSG,INMSGDSP,INMSGLG,INMSGST,INSEQNUM,INUIF,INXUIF,X
S (INMSGDSP,INMSGLG,INMSGST)=""
S INMSG="Evaluating response"
D:$G(INDEBUG) LOG^INHVCRA1(INMSG,8)
S RUN=$$INRHB^INHUVUT1(INBPN,INMSG)
; Start transaction audit for receipt of response
D:$D(XUAUDIT) TTSTRT^XUSAUD("","",INBPNM,"","RECEIVE")
;
S INERRHU=$$IN^INHUSEN(ING,.INDEST,INDSTR,.INSEQNUM,.INSEND,.INERR,.INXDST,"","",.INMSASTA,1,INSTD)
;
D:$D(XUAUDIT) TTSTP^XUSAUD(0) ;stop transaction audit
;
;INERRHU=
; 0 - no evaluation errors - kill msg, get next
; 1 - transient error - resend msg, log error
; 2 - fatal error - reroute msg, log error
; 3 - outgoing error - kill msg, log error
; 4 - incoming error - allow no-response timeout to cause resend, log error
; 5 - internal error - kill msg, get next
; 6 - heartbeat/dummy accept - get next
; 7 - heartbeat/dummy reject - continue heartbeat
;
D:$G(INDEBUG)
. I INERRHU D LOG^INHVCRA1("Code "_INERRHU_" evaluating response.",6) Q
. D LOG^INHVCRA1("Response accepted",9)
;
; Get originating UIF. If no INSEQNUM, INERRHU must = 4,6,7
I $G(INSEQNUM) D Q:'INUIF ; exit EVAL if seq #, but no orig UIF
. S INUIF=$O(^INLHDEST(INDSTR,"PEND",INBPN,INSEQNUM,""))
. I 'INUIF D ; no pending que entry to manage
.. S INXUIF=$O(^INTHU("ASEQ",INDSTR,INSEQNUM,"")) ; get UIF for debugging
.. I INERRHU,$D(INERR) D ENR^INHE(INBPN,.INERR)
.. S INMSG="No pending que entry for response with sequence number "_INSEQNUM_$S(INXUIF:" and UIF="_INXUIF,1:"")_": No further processing performed by "_INBPNM
.. D ENR^INHE(INBPN,INMSG)
.. D:$G(INDEBUG) LOG^INHVCRA1(INMSG,8)
;
; Post-eval processing
S INMSGST="Msg "_$S(("^0^6^")[(U_INERRHU_U):"accepted",1:"rejected")
S INMSGLG=INMSGST_" ("_INERRHU_")"_$S($G(INUIF):" for originating UIF= "_INUIF,1:"")
;
; 0 - no evaluation errors - kill msg, get next
I INERRHU=0 D
. D PQKILL^INHVTMT4(INDSTR,INSEQNUM,INUIF,.INPEND)
. D ULOG^INHU(INUIF,"C") ; mark complete
;
; 1 - transient error - resend msg, log error
I INERRHU=1 D
. I INIP("STRY")'>$P(^INLHDEST(INDSTR,"PEND",INBPN,INSEQNUM,INUIF),U,2) D Q
..; send tries exceeded, reroute msg to another xceiver
.. S X=$$GETPEND^INHVTMT4(INDSTR,INSEQNUM,INUIF,.INPEND)
.. S INMSGDSP=": Rerouting"
.. I INSTATE'="HB" D
... D ERRADD^INHUSEN3(.INERR,"Transceiver entering heartbeat state.")
... S INSTATE="HB" ; start heartbeat msgs following this read series
.;
.; else, send retries NOT exceeded
. D RESEND^INHVTMT4(INDSTR,INUIF,INSEQNUM)
. S INMSGDSP=": Resending"
;
; 2 - fatal error - reroute msg, log error
I INERRHU=2 D
. S X=$$GETPEND^INHVTMT4(INDSTR,INSEQNUM,INUIF,.INPEND)
. S INMSGDSP=": Rerouting"
. I INSTATE'="HB" D
.. D ERRADD^INHUSEN3(.INERR,"Transceiver entering heartbeat state.")
.. S INSTATE="HB" ; start heartbeat msgs following this read series
;
; 3 - outgoing (original o/b msg) error - kill msg, log error
I INERRHU=3 D
. D PQKILL^INHVTMT4(INDSTR,INSEQNUM,INUIF,.INPEND)
. S INMSGDSP=": Outbound msg error"
. D ULOG^INHU(INUIF,"E",.INERR) ; mark err
;
; 4 - incoming error - allow no-response timeout to cause resend, log error
; No sequence # or orig UIF unavailable
I INERRHU=4 D
. S INMSGDSP=": Inbound msg error"
;
; 5 - internal error - kill msg, get next
I INERRHU=5 D
. D PQKILL^INHVTMT4(INDSTR,INSEQNUM,INUIF,.INPEND)
. S INMSGDSP=": Internal error"
. D ULOG^INHU(INUIF,"E",.INERR) ; mark err
;
; 6 - heartbeat/dummy transaction accepted - start sending claims
; Sequence # = DUMMYTRX and no UIF unavailable
I INERRHU=6 D
. S INHBSENT=0,INMSGDSP=": Dummy trx successful"
.; if 1st time thru and pend que had entries on xceiver startup,
.; ck for timeout before sending new entries
. I INSYNC S INSTATE="TIMEOUT" Q
. I INSTATE="HB" D
.. D ERRADD^INHUSEN3(.INERR,"Transceiver exiting heartbeat state.")
.. S INSTATE="SEND" ; start sending claims
;
; 7 - heartbeat/dummy transaction rejected - continue in HB state
; Sequence # = DUMMYTRX and no UIF unavailable
I INERRHU=7 D
. S INMSGST="",INMSGDSP=": Dummy trx failed,Attempt "_INHBSENT_" with no response"
. S INSTATE="HB",INHBSENT=0 ; reset cnt if dummy response
;
I INERRHU,$D(INERR) D ENR^INHE(INBPN,.INERR) ; log err
S INRUNMT=$$INRHB^INHUVUT1(INBPN,INMSGST_INMSGDSP,$S(INERRHU:0,1:1))
D:$G(INDEBUG) LOG^INHVCRA1(INMSGLG_INMSGDSP,8)
Q
;
DATAFRAG(INBFR,INSTART,INEND) ; Data Fragmentation (possibly across bfrs).
; Log error & reset vars.
;
; Called by: RECEIVE^INHVTMT2
;
; Input:
; INBFR - (req) Bfr containing frag
; INSTART - (req) Char from which to start logging frag
; INEND - (req) Char at which to stop logging frag
;
N INERRMSG,INERRREC
S INERRREC=$$CLEAN^INHUVUT($E(INBFR,INSTART,INEND))
; if crosses bfrs, logs chars in this INBFR only
S INERRMSG="Data Fragmentation error. Ignored: "_$E(INERRREC,1,450)
D ENR^INHE(INBPN,INERRMSG)
D:$G(INDEBUG) LOG^INHVCRA1(INERRMSG,3)
F I="SOM","SOD","EOM" S INPOS(I)=0
K @INREC S INREC="REC",INRECCNT=0
S INRSTATE="SOM" ; looking for SOM
S INFIRST=1 ; 1st time thru decryptor per msg
S INCLRMSG='$G(INIP("CRYPT")) ; 1 = do not decrypt rcv'd msg
S INIVBLD=""
Q
;
;
INHVTMT3 ; KAC ; 04 Nov 1999 15:32 ; Multi-threaded TCP/IP socket utilities
+1 ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
+2 ;COPYRIGHT 1991-2000 SAIC
+3 QUIT
+4 ;
GETFRAME(INBFR,INFRMCHR,INFRMPOS) ; Create array of framing char positions
+1 ; in INBFR. E.g. INFRMPOS(5)=SOM, INFRMPOS(29)=SOM, INFRMPOS(134)=SOM
+2 ;
+3 ; Called by: RECEIVE^INHVTMT2
+4 ;
+5 ; Input:
+6 ; INBFR - (req) Buffer read by %INET (up to 512 bytes long)
+7 ; INFRMCHR - (req) Framing char(s) to search for
+8 ;
+9 ; Output:
+10 ; INFRMPOS - (pbr) Array of framing chars in INBFR by position
+11 ;
+12 NEW INFOUND
+13 SET INFOUND=0
+14 FOR
Begin DoDot:1
+15 SET INFOUND=$FIND(INBFR,INFRMCHR,INFOUND)
+16 IF 'INFOUND
QUIT
+17 SET INFRMPOS(INFOUND-$LENGTH(INFRMCHR))=INFRMCHR
End DoDot:1
IF 'INFOUND
QUIT
+18 QUIT
+19 ;
PUTINREC(INMSG) ; Put msg (may only be a piece of msg) into INREC array
+1 ; Remove msg framing chars from msg portion and decrypt.
+2 ;
+3 ; Called by: RECEIVE^INHVTMT2
+4 ;
+5 NEW X,INCLRHDR,INLAST,INMSGHDR,INTYPE
+6 SET INLAST=$SELECT(INMSG[INEOM:1,1:0)
+7 ; remove SOM
IF INMSG[INSOM
SET INMSG=$EXTRACT(INMSG,$FIND(INMSG,INSOM),$LENGTH(INMSG))
+8 ; remove EOM
IF INLAST
SET INMSG=$TRANSLATE(INMSG,INEOM)
+9 ; PDTS requires that ER & SE msg type be sent to CHCS unencrypted
+10 ; Check TYPE in msg hdr
+11 IF INSTD="PDTS"
IF '$GET(INCLRMSG)
IF (INMSG[INSOD)
Begin DoDot:1
+12 SET X=""
FOR
SET X=$ORDER(@INREC@(X))
IF 'X
QUIT
SET INMSGHDR=$GET(INMSGHDR)_@INREC@(X)
+13 SET INMSGHDR=$GET(INMSGHDR)_$PIECE(INMSG,INSOD)
+14 SET INCLRMSG="^ER^SE^"[(U_$EXTRACT(INMSGHDR,3,4)_U)
End DoDot:1
+15 IF INSTD="PDTS"
IF '$GET(INCLRMSG)
SET INCLRHDR=$SELECT((INMSG[INSOD):1,(INRSTATE="SOD"):1,1:0)
+16 ; grp separator
IF $DATA(INSOD)
IF (INMSG[INSOD)
SET INMSG=$TRANSLATE(INMSG,INSOD,INEOL)
+17 ;
+18 ; Decrypt all except 1st hdr (E.g. SOM-ENP Hdr Data-EOL) and EOM char
+19 IF $LENGTH(INMSG)
IF '$GET(INCLRMSG)
Begin DoDot:1
+20 ; do NOT decrypt any part of 1st hdr
IF $GET(INCLRHDR)
Begin DoDot:2
+21 SET INMSGHDR=$PIECE(INMSG,INEOL)_$SELECT(INMSG[INEOL:INEOL,1:"")
+22 ; decrypt after 1st hdr
+23 SET INMSG=$PIECE(INMSG,INEOL,2,99999)
End DoDot:2
+24 IF $LENGTH(INMSG)
Begin DoDot:2
+25 ; if partial IV at start of encrypted msg, save til have full IV
+26 IF INFIRST
IF (($LENGTH(INIVBLD)+$LENGTH(INMSG))<INIVLEN)
SET INIVBLD=INIVBLD_INMSG
SET INMSG=""
QUIT
+27 IF $LENGTH(INIVBLD)
Begin DoDot:3
+28 IF ($LENGTH(INIVBLD)+$LENGTH(INMSG))'>512
SET INMSG=INIVBLD_INMSG
QUIT
+29 SET INIVBLD=INIVBLD_$EXTRACT(INMSG,1,INIVLEN)
+30 SET INMSG=$EXTRACT(INMSG,INIVLEN+1,99999)
+31 DO DECRYPT^INCRYPT(.INIVBLD,.X,$LENGTH(INIVBLD),INFIRST,0)
+32 SET INIVBLD=X
SET INFIRST=0
+33 DO STORE(INIVBLD)
End DoDot:3
SET INIVBLD=""
+34 ;
+35 DO DECRYPT^INCRYPT(.INMSG,.X,$LENGTH(INMSG),INFIRST,INLAST)
+36 SET INMSG=X
SET INFIRST=$SELECT(INLAST:1,1:0)
End DoDot:2
+37 ;
+38 IF $GET(INCLRHDR)
SET INMSG=INMSGHDR_INMSG
End DoDot:1
+39 ;
+40 IF INLAST
SET INCLRMSG='$GET(INIP("CRYPT"))
+41 DO STORE(INMSG)
+42 QUIT
+43 ;
STORE(INMSG) ; Store decrypted msg in INREC
+1 IF '$LENGTH(INMSG)
QUIT
+2 ; transform field separator
IF $DATA(INFS)
SET INMSG=$TRANSLATE(INMSG,INFS,INDELIM)
+3 ; Ck $Storage for rollover to global
+4 IF $STORAGE<INSMIN
Begin DoDot:1
+5 IF INREC["^"
QUIT
+6 KILL ^UTILITY("INREC",$JOB)
+7 MERGE ^UTILITY("INREC",$JOB)=@INREC
KILL @INREC
SET INREC="^UTILITY(""INREC"","_$JOB_")"
End DoDot:1
+8 ;
+9 SET INRECCNT=INRECCNT+1
SET @INREC@(INRECCNT)=INMSG
+10 QUIT
+11 ;
EVAL(ING) ; Evaluate incoming response. Msg is marked complete
+1 ; when o/p ctlr runs inbound script.
+2 ;
+3 ; Called by: RECEIVE^INHVTMT2
+4 ;
+5 ; Input:
+6 ; ING - (req) Array in which decrypted, parsed msg is stored.
+7 ;
+8 NEW INERR,INERRHU,INMSG,INMSGDSP,INMSGLG,INMSGST,INSEQNUM,INUIF,INXUIF,X
+9 SET (INMSGDSP,INMSGLG,INMSGST)=""
+10 SET INMSG="Evaluating response"
+11 IF $GET(INDEBUG)
DO LOG^INHVCRA1(INMSG,8)
+12 SET RUN=$$INRHB^INHUVUT1(INBPN,INMSG)
+13 ; Start transaction audit for receipt of response
+14 IF $DATA(XUAUDIT)
DO TTSTRT^XUSAUD("","",INBPNM,"","RECEIVE")
+15 ;
+16 SET INERRHU=$$IN^INHUSEN(ING,.INDEST,INDSTR,.INSEQNUM,.INSEND,.INERR,.INXDST,"","",.INMSASTA,1,INSTD)
+17 ;
+18 ;stop transaction audit
IF $DATA(XUAUDIT)
DO TTSTP^XUSAUD(0)
+19 ;
+20 ;INERRHU=
+21 ; 0 - no evaluation errors - kill msg, get next
+22 ; 1 - transient error - resend msg, log error
+23 ; 2 - fatal error - reroute msg, log error
+24 ; 3 - outgoing error - kill msg, log error
+25 ; 4 - incoming error - allow no-response timeout to cause resend, log error
+26 ; 5 - internal error - kill msg, get next
+27 ; 6 - heartbeat/dummy accept - get next
+28 ; 7 - heartbeat/dummy reject - continue heartbeat
+29 ;
+30 IF $GET(INDEBUG)
Begin DoDot:1
+31 IF INERRHU
DO LOG^INHVCRA1("Code "_INERRHU_" evaluating response.",6)
QUIT
+32 DO LOG^INHVCRA1("Response accepted",9)
End DoDot:1
+33 ;
+34 ; Get originating UIF. If no INSEQNUM, INERRHU must = 4,6,7
+35 ; exit EVAL if seq #, but no orig UIF
IF $GET(INSEQNUM)
Begin DoDot:1
+36 SET INUIF=$ORDER(^INLHDEST(INDSTR,"PEND",INBPN,INSEQNUM,""))
+37 ; no pending que entry to manage
IF 'INUIF
Begin DoDot:2
+38 ; get UIF for debugging
SET INXUIF=$ORDER(^INTHU("ASEQ",INDSTR,INSEQNUM,""))
+39 IF INERRHU
IF $DATA(INERR)
DO ENR^INHE(INBPN,.INERR)
+40 SET INMSG="No pending que entry for response with sequence number "_INSEQNUM_$SELECT(INXUIF:" and UIF="_INXUIF,1:"")_": No further processing performed by "_INBPNM
+41 DO ENR^INHE(INBPN,INMSG)
+42 IF $GET(INDEBUG)
DO LOG^INHVCRA1(INMSG,8)
End DoDot:2
End DoDot:1
IF 'INUIF
QUIT
+43 ;
+44 ; Post-eval processing
+45 SET INMSGST="Msg "_$SELECT(("^0^6^")[(U_INERRHU_U):"accepted",1:"rejected")
+46 SET INMSGLG=INMSGST_" ("_INERRHU_")"_$SELECT($GET(INUIF):" for originating UIF= "_INUIF,1:"")
+47 ;
+48 ; 0 - no evaluation errors - kill msg, get next
+49 IF INERRHU=0
Begin DoDot:1
+50 DO PQKILL^INHVTMT4(INDSTR,INSEQNUM,INUIF,.INPEND)
+51 ; mark complete
DO ULOG^INHU(INUIF,"C")
End DoDot:1
+52 ;
+53 ; 1 - transient error - resend msg, log error
+54 IF INERRHU=1
Begin DoDot:1
+55 IF INIP("STRY")'>$PIECE(^INLHDEST(INDSTR,"PEND",INBPN,INSEQNUM,INUIF),U,2)
Begin DoDot:2
+56 ; send tries exceeded, reroute msg to another xceiver
+57 SET X=$$GETPEND^INHVTMT4(INDSTR,INSEQNUM,INUIF,.INPEND)
+58 SET INMSGDSP=": Rerouting"
+59 IF INSTATE'="HB"
Begin DoDot:3
+60 DO ERRADD^INHUSEN3(.INERR,"Transceiver entering heartbeat state.")
+61 ; start heartbeat msgs following this read series
SET INSTATE="HB"
End DoDot:3
End DoDot:2
QUIT
+62 ;
+63 ; else, send retries NOT exceeded
+64 DO RESEND^INHVTMT4(INDSTR,INUIF,INSEQNUM)
+65 SET INMSGDSP=": Resending"
End DoDot:1
+66 ;
+67 ; 2 - fatal error - reroute msg, log error
+68 IF INERRHU=2
Begin DoDot:1
+69 SET X=$$GETPEND^INHVTMT4(INDSTR,INSEQNUM,INUIF,.INPEND)
+70 SET INMSGDSP=": Rerouting"
+71 IF INSTATE'="HB"
Begin DoDot:2
+72 DO ERRADD^INHUSEN3(.INERR,"Transceiver entering heartbeat state.")
+73 ; start heartbeat msgs following this read series
SET INSTATE="HB"
End DoDot:2
End DoDot:1
+74 ;
+75 ; 3 - outgoing (original o/b msg) error - kill msg, log error
+76 IF INERRHU=3
Begin DoDot:1
+77 DO PQKILL^INHVTMT4(INDSTR,INSEQNUM,INUIF,.INPEND)
+78 SET INMSGDSP=": Outbound msg error"
+79 ; mark err
DO ULOG^INHU(INUIF,"E",.INERR)
End DoDot:1
+80 ;
+81 ; 4 - incoming error - allow no-response timeout to cause resend, log error
+82 ; No sequence # or orig UIF unavailable
+83 IF INERRHU=4
Begin DoDot:1
+84 SET INMSGDSP=": Inbound msg error"
End DoDot:1
+85 ;
+86 ; 5 - internal error - kill msg, get next
+87 IF INERRHU=5
Begin DoDot:1
+88 DO PQKILL^INHVTMT4(INDSTR,INSEQNUM,INUIF,.INPEND)
+89 SET INMSGDSP=": Internal error"
+90 ; mark err
DO ULOG^INHU(INUIF,"E",.INERR)
End DoDot:1
+91 ;
+92 ; 6 - heartbeat/dummy transaction accepted - start sending claims
+93 ; Sequence # = DUMMYTRX and no UIF unavailable
+94 IF INERRHU=6
Begin DoDot:1
+95 SET INHBSENT=0
SET INMSGDSP=": Dummy trx successful"
+96 ; if 1st time thru and pend que had entries on xceiver startup,
+97 ; ck for timeout before sending new entries
+98 IF INSYNC
SET INSTATE="TIMEOUT"
QUIT
+99 IF INSTATE="HB"
Begin DoDot:2
+100 DO ERRADD^INHUSEN3(.INERR,"Transceiver exiting heartbeat state.")
+101 ; start sending claims
SET INSTATE="SEND"
End DoDot:2
End DoDot:1
+102 ;
+103 ; 7 - heartbeat/dummy transaction rejected - continue in HB state
+104 ; Sequence # = DUMMYTRX and no UIF unavailable
+105 IF INERRHU=7
Begin DoDot:1
+106 SET INMSGST=""
SET INMSGDSP=": Dummy trx failed,Attempt "_INHBSENT_" with no response"
+107 ; reset cnt if dummy response
SET INSTATE="HB"
SET INHBSENT=0
End DoDot:1
+108 ;
+109 ; log err
IF INERRHU
IF $DATA(INERR)
DO ENR^INHE(INBPN,.INERR)
+110 SET INRUNMT=$$INRHB^INHUVUT1(INBPN,INMSGST_INMSGDSP,$SELECT(INERRHU:0,1:1))
+111 IF $GET(INDEBUG)
DO LOG^INHVCRA1(INMSGLG_INMSGDSP,8)
+112 QUIT
+113 ;
DATAFRAG(INBFR,INSTART,INEND) ; Data Fragmentation (possibly across bfrs).
+1 ; Log error & reset vars.
+2 ;
+3 ; Called by: RECEIVE^INHVTMT2
+4 ;
+5 ; Input:
+6 ; INBFR - (req) Bfr containing frag
+7 ; INSTART - (req) Char from which to start logging frag
+8 ; INEND - (req) Char at which to stop logging frag
+9 ;
+10 NEW INERRMSG,INERRREC
+11 SET INERRREC=$$CLEAN^INHUVUT($EXTRACT(INBFR,INSTART,INEND))
+12 ; if crosses bfrs, logs chars in this INBFR only
+13 SET INERRMSG="Data Fragmentation error. Ignored: "_$EXTRACT(INERRREC,1,450)
+14 DO ENR^INHE(INBPN,INERRMSG)
+15 IF $GET(INDEBUG)
DO LOG^INHVCRA1(INERRMSG,3)
+16 FOR I="SOM","SOD","EOM"
SET INPOS(I)=0
+17 KILL @INREC
SET INREC="REC"
SET INRECCNT=0
+18 ; looking for SOM
SET INRSTATE="SOM"
+19 ; 1st time thru decryptor per msg
SET INFIRST=1
+20 ; 1 = do not decrypt rcv'd msg
SET INCLRMSG='$GET(INIP("CRYPT"))
+21 SET INIVBLD=""
+22 QUIT
+23 ;
+24 ;