- HLCS ;ALB/RJS,MTC,JRP - COMMUNICATIONS SERVER - ;10/04/2007 14:34
- ;;1.6;HEALTH LEVEL SEVEN;**2,9,14,19,43,57,109,132,122,166**;Oct 13, 1995;Build 1
- ;;Per VA Directive 6402, this routine should not be modified.
- ;
- ;The SEND function is invoked by the transaction processor.
- ;It's function is to $O through the ITEM multiple of the Event Driver
- ;Protocol and create child entries in the Message Text file (#772)
- ;for the message at HLMTIEN. These child messages point back
- ;to the parent message so that message text does not need to
- ;be duplicated when a message is sent to multiple applications.
- ;
- ;The SENDACK function is also invoked by the transaction processor.
- ;It's function is to create a child entry in the Message Text file
- ;for the message at HLMTIENA and deliver the message to the
- ;application the requested/sent information.
- ;
- ;For DHCP to DHCP messaging (i.e. internal to internal), an incoming
- ;message is created in the Message Text file which is a duplication
- ;of the outgoing message. The incoming message is then processed by
- ;calling the transaction processor.
- ;
- ;For DHCP to COTS messaging (i.e. internal to external), the message
- ;is filed in the Message Text file with the Logical Link defined and
- ;a status of PENDING TRANSMISSION. These entries are picked up by
- ;the background filer and transmitted to the appropriate COTS system.
- ;
- SEND(HLMTIEN,HLEID,HLRESULT) ;Send an HL7 message
- ;HLMTIEN=The IEN of the parent message in file # 772
- ;HLEID=The IEN of the Event Driver protocol in file #101
- ;HLRESULT=Variable for any error text (pass by reference)
- ;
- ;Declare variables
- N HLARY,HLERROR,HLEIDS,HLCLIENT,HLOGLINK,HLMTIENS,HLMSGPTR
- S HLERROR=""
- ;Direct connect
- I HLPRIO="I" D Q
- . D DC^HLMA2
- . S HLRESULT=HLERROR
- ;Get all subscribers to the message
- D ITEM^HLUTIL2(HLEID,"PTR")
- ;Quit if no subscribers (considered successful delivery)
- G:($G(HLARY(0))'>0) EXIT
- ;Deliver message to each subscriber
- S HLEIDS=0
- F S HLEIDS=$O(HLARY(HLEIDS)) Q:(HLEIDS'>0) D
- .;
- .;**132 excluded subscribers **
- .N I,EXCLUDE
- .S (EXCLUDE,I)=0
- . ;
- . ; patch HL*1.6*122
- . ; F S I=$O(HLP("EXCLUDE SUBSCRIBER",I)) Q:'I I $G(HLP("EXCLUDE SUBSCRIBER",I))=HLEIDS S EXCLUDE=1 Q
- . F S I=$O(HLP("EXCLUDE SUBSCRIBER",I)) Q:'I D Q:EXCLUDE
- .. N TEMP
- .. S TEMP=HLP("EXCLUDE SUBSCRIBER",I)
- .. I 'TEMP,TEMP]"" S TEMP=$O(^ORD(101,"B",TEMP,0))
- .. I TEMP=HLEIDS S EXCLUDE=1
- . ; patch HL*1.6*122
- . ;
- .Q:EXCLUDE
- .;** 132 end **
- .;
- .;Get pointer to receiving application
- .S HLCLIENT=+HLARY(HLEIDS),HL("EIDS")=HLEIDS,HLERROR=""
- .Q:(HLCLIENT'>0)
- .;Check and execute ROUTING LOGIC **CIRN**
- .S HLX=$G(^ORD(101,HLEIDS,774))
- .I HLX]"" D Q
- ..;HL*1.6*166 RESET HLDONE1 SO THAT HLNEXT DOES NOT EVALUATE THE HL7 MESS. ADMIN. file
- ..N HLQUIT,HLNODE,HLNEXT,HLDONE1
- ..S (HLQUIT,HLDONE1)=0,HLNODE="",HLNEXT="D HLNEXT^HLCSUTL"
- ..X HLX I $D(HLL("LINKS")) D FWD^HLCS2 K HLL ;**CIRN**
- .;Get pointer to logical link
- .S HLOGLINK=$P(HLARY(HLEIDS),"^",2)
- .;Determine if receiving application is internal or external
- .; Logical link has a value for external applications
- .; Logical link is NULL for internal applications
- .I (HLOGLINK) D COTS Q
- .;Create 'incoming' message based on 'outgoing' message (internal)
- .D DHCP(HLMTIEN,HLEIDS,HLCLIENT)
- .Q:(HLERROR)
- .;Process the 'incoming' message
- .S HLERROR=""
- .D PROCESS^HLTP0(HLMSGPTR,"DHCP","",.HLERROR)
- .;Update Status of 'incoming' message to SUCCESSFULLY COMPLETED
- .; or ERROR DURING TRANSMISSION
- .D STATUS^HLTF0(HLMSGPTR,$S(HLERROR:4,1:3),$S(HLERROR:+HLERROR,1:""),$S(HLERROR:$P(HLERROR,"^",2),1:""),,$S($G(HLERR("SKIP_EVENT"))=1:1,1:0))
- .I $D(HLL("LINKS")) D FWD^HLCS2 K HLL ;**CIRN**
- D ADD^HLCS2 ;**CIRN**
- EXIT S HLRESULT=HLERROR
- Q
- COTS ;Internal to external communication
- ;Create child entry in Message Text file
- N HLTCP,HLTCPI,HLTCPO
- D SEND^HLMA2(HLEIDS,HLMTIEN,HLCLIENT,"D",.HLMTIENS,HLOGLINK)
- I ((+HLMTIENS)'>0) S HLERROR=HLMTIENS Q
- ;'Pass' message to background filer by setting status of child
- ; to PENDING TRANSMISSION
- D STATUS^HLTF0(HLMTIENS,1)
- Q
- DHCP(HLMTIEN,HLEIDS,HLCLIENT) ;Internal to internal communication
- ;
- ;Input : HLMTIEN - Pointer to parent outgoing message (file #772)
- ; HLEIDS - Pointer to subscribing protocol (file #101)
- ; HLCLIENT - Pointer to receiving application (file # 771)
- ;
- ;Output : HLMTIENS - Pointer to child outgoing message (file #772)
- ; HLMSGPTR - Pointer to [parent] incoming message (file #772)
- ; HLERROR - ErrorCode ^ ErrorText
- ;
- ;Notes : This module only copies the outgoing message into an incoming
- ; message. Delivery of the message (i.e. processing of it)
- ; must be done by the calling application.
- ; : Message/batch header (MSH/BSH) is built and placed in the
- ; incoming message
- ; : HLMTIENS, HLMSGPTR, and HLERROR will be initialized
- ; : Existance and validity of input is assumed
- ;
- ;Declare variables
- N MSGID,MSGDT,MSGDTH,HDR2BLD,TMP,HLHDR,BHSHDR
- S HLERROR=""
- S HLMTIENS=0
- S HLMSGPTR=0
- ;Create child entry in Message Text file
- D SEND^HLMA2(HLEIDS,HLMTIEN,HLCLIENT,"D",.HLMTIENS)
- I ((+HLMTIENS)'>0) S HLERROR=HLMTIENS Q
- ;'Receive' message by making an incoming message
- ;Determine type of header to build
- S TMP=$G(^HL(772,HLMTIEN,0))
- S HDR2BLD=$P(TMP,"^",14)
- ;Build message header (MSH)
- I (HDR2BLD="M") D Q:(HLERROR)
- .S TMP=""
- .D HEADER^HLCSHDR(HLMTIENS,.TMP)
- .Q:(TMP="")
- .;Error building header
- .S HLERROR="4^Unable to build message header => "_TMP
- .D STATUS^HLTF0(HLMTIENS,4,0,$P(HLERROR,"^",2))
- ;Build batch header (BHS or FHS)
- I (HDR2BLD'="M") D Q:(HLERROR)
- .S TMP=""
- .D BHSHDR^HLCSHDR(HLMTIENS)
- .S:($E(HLHDR(1),1)="-") TMP=$P(HLHDR(1),"^",2)
- .Q:(TMP="")
- .;Error building header
- .S HLERROR="4^Unable to build batch header => "_TMP
- .D STATUS^HLTF0(HLMTIENS,4,0,$P(HLERROR,"^",2))
- ;Create entry for 'incoming' message
- D CREATE^HLTF(.MSGID,.HLMSGPTR,.MSGDT,.MSGDTH)
- ;Move header and rest of message into 'incoming' message
- I (HDR2BLD="M") D
- .;Use MSH as header
- .D MRGINT^HLTF1(HLMTIEN,HLMSGPTR,"HLHDR")
- I (HDR2BLD'="M") D
- .;Use BHS or FHS as header
- .D MRGINT^HLTF1(HLMTIEN,HLMSGPTR,"BHSHDR")
- ;Set status of outgoing message to AWAITING ACKNOWLEDGEMENT
- D STATUS^HLTF0(HLMTIENS,$S($P(^HL(772,HLMTIEN,0),U,7):3,1:2))
- ;Set status of 'incoming' message to AWAITING PROCESSING
- D STATUS^HLTF0(HLMSGPTR,9)
- Q
- SENDACK(HLMTIENA,HLEID,HLEIDS,HLRESULT) ;Send an HL7 acknowledgement/response
- ;HLMTIENA=The IEN of the parent acknowledgment/response message in
- ; file # 772
- ;HLEIDS=The IEN of the Subscribing protocol in file # 101
- ;HLEID=The IEN of the Event Driver protocol in file #101
- ;HLRESULT=Variable for any error text (pass by reference)
- ;
- N HLERROR,HLOGLINK,HLCLIENT,HLMTIENS,HLMSGPTR,HLCLNODE
- I $G(HLMTIENA)=""!($G(HLEID)="")!($G(HLEIDS)="") S HLERROR="0^7^"_$G(^HL(771.7,7,0))_"at SENDACK^HLCS entry point" G EXIT2
- S HLCLNODE=$G(^ORD(101,HLEID,770))
- ;Get pointers to Logical Link & receiving application
- S HLOGLINK=$P($G(^ORD(101,HLEIDS,770)),U,7)
- ;Application needed to dynamically address the ACK (tcp/ip)
- ;(set HLL("LINKS") array before calling GENACK)
- I $D(HLL("LINKS")) D Q:'HLOGLINK
- .S HLOGLINK=$P(HLL("LINKS",1),"^",2) Q:HLOGLINK=""
- .K HLL("LINKS")
- .I +HLOGLINK'=HLOGLINK S HLOGLINK=$O(^HLCS(870,"B",HLOGLINK,0))
- S HLCLIENT=$P(HLCLNODE,U,1)
- Q:('HLCLIENT)
- ;Determine if receiving application is internal or external
- ; Logical link has a value for external applications
- ; Logical link is NULL for internal applications
- I (HLOGLINK) D COTSACK Q
- ;Create 'incoming' message based on 'outgoing' message (internal)
- D DHCP(HLMTIENA,HLEID,HLCLIENT)
- ;Process the 'incoming' message
- I (HLMSGPTR) D
- .S HLERROR=""
- .D PROCESS^HLTP0(HLMSGPTR,"DHCP","",.HLERROR)
- ;Update Status of 'incoming' message to SUCCESSFULLY COMPLETED
- ; or ERROR DURING TRANSMISSION
- D STATUS^HLTF0(HLMSGPTR,$S(HLERROR:4,1:3),$S(HLERROR:+HLERROR,1:""),$S(HLERROR:$P(HLERROR,"^",2),1:""))
- EXIT2 ;
- S HLRESULT=$G(HLERROR)
- Q
- COTSACK ;Internal to external communication of acknowledgements/responses
- ;Create child entry in Message Text file
- D SEND^HLMA2(HLEID,HLMTIENA,HLCLIENT,"D",.HLMTIENS,HLOGLINK)
- ;'Pass' message to background filer by setting status of child
- ; to PENDING TRANSMISSION
- D STATUS^HLTF0(HLMTIENS,1)
- Q
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HHLCS 8531 printed Feb 18, 2025@23:22:41 Page 2
- HLCS ;ALB/RJS,MTC,JRP - COMMUNICATIONS SERVER - ;10/04/2007 14:34
- +1 ;;1.6;HEALTH LEVEL SEVEN;**2,9,14,19,43,57,109,132,122,166**;Oct 13, 1995;Build 1
- +2 ;;Per VA Directive 6402, this routine should not be modified.
- +3 ;
- +4 ;The SEND function is invoked by the transaction processor.
- +5 ;It's function is to $O through the ITEM multiple of the Event Driver
- +6 ;Protocol and create child entries in the Message Text file (#772)
- +7 ;for the message at HLMTIEN. These child messages point back
- +8 ;to the parent message so that message text does not need to
- +9 ;be duplicated when a message is sent to multiple applications.
- +10 ;
- +11 ;The SENDACK function is also invoked by the transaction processor.
- +12 ;It's function is to create a child entry in the Message Text file
- +13 ;for the message at HLMTIENA and deliver the message to the
- +14 ;application the requested/sent information.
- +15 ;
- +16 ;For DHCP to DHCP messaging (i.e. internal to internal), an incoming
- +17 ;message is created in the Message Text file which is a duplication
- +18 ;of the outgoing message. The incoming message is then processed by
- +19 ;calling the transaction processor.
- +20 ;
- +21 ;For DHCP to COTS messaging (i.e. internal to external), the message
- +22 ;is filed in the Message Text file with the Logical Link defined and
- +23 ;a status of PENDING TRANSMISSION. These entries are picked up by
- +24 ;the background filer and transmitted to the appropriate COTS system.
- +25 ;
- SEND(HLMTIEN,HLEID,HLRESULT) ;Send an HL7 message
- +1 ;HLMTIEN=The IEN of the parent message in file # 772
- +2 ;HLEID=The IEN of the Event Driver protocol in file #101
- +3 ;HLRESULT=Variable for any error text (pass by reference)
- +4 ;
- +5 ;Declare variables
- +6 NEW HLARY,HLERROR,HLEIDS,HLCLIENT,HLOGLINK,HLMTIENS,HLMSGPTR
- +7 SET HLERROR=""
- +8 ;Direct connect
- +9 IF HLPRIO="I"
- Begin DoDot:1
- +10 DO DC^HLMA2
- +11 SET HLRESULT=HLERROR
- End DoDot:1
- QUIT
- +12 ;Get all subscribers to the message
- +13 DO ITEM^HLUTIL2(HLEID,"PTR")
- +14 ;Quit if no subscribers (considered successful delivery)
- +15 if ($GET(HLARY(0))'>0)
- GOTO EXIT
- +16 ;Deliver message to each subscriber
- +17 SET HLEIDS=0
- +18 FOR
- SET HLEIDS=$ORDER(HLARY(HLEIDS))
- if (HLEIDS'>0)
- QUIT
- Begin DoDot:1
- +19 ;
- +20 ;**132 excluded subscribers **
- +21 NEW I,EXCLUDE
- +22 SET (EXCLUDE,I)=0
- +23 ;
- +24 ; patch HL*1.6*122
- +25 ; F S I=$O(HLP("EXCLUDE SUBSCRIBER",I)) Q:'I I $G(HLP("EXCLUDE SUBSCRIBER",I))=HLEIDS S EXCLUDE=1 Q
- +26 FOR
- SET I=$ORDER(HLP("EXCLUDE SUBSCRIBER",I))
- if 'I
- QUIT
- Begin DoDot:2
- +27 NEW TEMP
- +28 SET TEMP=HLP("EXCLUDE SUBSCRIBER",I)
- +29 IF 'TEMP
- IF TEMP]""
- SET TEMP=$ORDER(^ORD(101,"B",TEMP,0))
- +30 IF TEMP=HLEIDS
- SET EXCLUDE=1
- End DoDot:2
- if EXCLUDE
- QUIT
- +31 ; patch HL*1.6*122
- +32 ;
- +33 if EXCLUDE
- QUIT
- +34 ;** 132 end **
- +35 ;
- +36 ;Get pointer to receiving application
- +37 SET HLCLIENT=+HLARY(HLEIDS)
- SET HL("EIDS")=HLEIDS
- SET HLERROR=""
- +38 if (HLCLIENT'>0)
- QUIT
- +39 ;Check and execute ROUTING LOGIC **CIRN**
- +40 SET HLX=$GET(^ORD(101,HLEIDS,774))
- +41 IF HLX]""
- Begin DoDot:2
- +42 ;HL*1.6*166 RESET HLDONE1 SO THAT HLNEXT DOES NOT EVALUATE THE HL7 MESS. ADMIN. file
- +43 NEW HLQUIT,HLNODE,HLNEXT,HLDONE1
- +44 SET (HLQUIT,HLDONE1)=0
- SET HLNODE=""
- SET HLNEXT="D HLNEXT^HLCSUTL"
- +45 ;**CIRN**
- XECUTE HLX
- IF $DATA(HLL("LINKS"))
- DO FWD^HLCS2
- KILL HLL
- End DoDot:2
- QUIT
- +46 ;Get pointer to logical link
- +47 SET HLOGLINK=$PIECE(HLARY(HLEIDS),"^",2)
- +48 ;Determine if receiving application is internal or external
- +49 ; Logical link has a value for external applications
- +50 ; Logical link is NULL for internal applications
- +51 IF (HLOGLINK)
- DO COTS
- QUIT
- +52 ;Create 'incoming' message based on 'outgoing' message (internal)
- +53 DO DHCP(HLMTIEN,HLEIDS,HLCLIENT)
- +54 if (HLERROR)
- QUIT
- +55 ;Process the 'incoming' message
- +56 SET HLERROR=""
- +57 DO PROCESS^HLTP0(HLMSGPTR,"DHCP","",.HLERROR)
- +58 ;Update Status of 'incoming' message to SUCCESSFULLY COMPLETED
- +59 ; or ERROR DURING TRANSMISSION
- +60 DO STATUS^HLTF0(HLMSGPTR,$SELECT(HLERROR:4,1:3),$SELECT(HLERROR:+HLERROR,1:""),$SELECT(HLERROR:$PIECE(HLERROR,"^",2),1:""),,$SELECT($GET(HLERR("SKIP_EVENT"))=1:1,1:0))
- +61 ;**CIRN**
- IF $DATA(HLL("LINKS"))
- DO FWD^HLCS2
- KILL HLL
- End DoDot:1
- +62 ;**CIRN**
- DO ADD^HLCS2
- EXIT SET HLRESULT=HLERROR
- +1 QUIT
- COTS ;Internal to external communication
- +1 ;Create child entry in Message Text file
- +2 NEW HLTCP,HLTCPI,HLTCPO
- +3 DO SEND^HLMA2(HLEIDS,HLMTIEN,HLCLIENT,"D",.HLMTIENS,HLOGLINK)
- +4 IF ((+HLMTIENS)'>0)
- SET HLERROR=HLMTIENS
- QUIT
- +5 ;'Pass' message to background filer by setting status of child
- +6 ; to PENDING TRANSMISSION
- +7 DO STATUS^HLTF0(HLMTIENS,1)
- +8 QUIT
- DHCP(HLMTIEN,HLEIDS,HLCLIENT) ;Internal to internal communication
- +1 ;
- +2 ;Input : HLMTIEN - Pointer to parent outgoing message (file #772)
- +3 ; HLEIDS - Pointer to subscribing protocol (file #101)
- +4 ; HLCLIENT - Pointer to receiving application (file # 771)
- +5 ;
- +6 ;Output : HLMTIENS - Pointer to child outgoing message (file #772)
- +7 ; HLMSGPTR - Pointer to [parent] incoming message (file #772)
- +8 ; HLERROR - ErrorCode ^ ErrorText
- +9 ;
- +10 ;Notes : This module only copies the outgoing message into an incoming
- +11 ; message. Delivery of the message (i.e. processing of it)
- +12 ; must be done by the calling application.
- +13 ; : Message/batch header (MSH/BSH) is built and placed in the
- +14 ; incoming message
- +15 ; : HLMTIENS, HLMSGPTR, and HLERROR will be initialized
- +16 ; : Existance and validity of input is assumed
- +17 ;
- +18 ;Declare variables
- +19 NEW MSGID,MSGDT,MSGDTH,HDR2BLD,TMP,HLHDR,BHSHDR
- +20 SET HLERROR=""
- +21 SET HLMTIENS=0
- +22 SET HLMSGPTR=0
- +23 ;Create child entry in Message Text file
- +24 DO SEND^HLMA2(HLEIDS,HLMTIEN,HLCLIENT,"D",.HLMTIENS)
- +25 IF ((+HLMTIENS)'>0)
- SET HLERROR=HLMTIENS
- QUIT
- +26 ;'Receive' message by making an incoming message
- +27 ;Determine type of header to build
- +28 SET TMP=$GET(^HL(772,HLMTIEN,0))
- +29 SET HDR2BLD=$PIECE(TMP,"^",14)
- +30 ;Build message header (MSH)
- +31 IF (HDR2BLD="M")
- Begin DoDot:1
- +32 SET TMP=""
- +33 DO HEADER^HLCSHDR(HLMTIENS,.TMP)
- +34 if (TMP="")
- QUIT
- +35 ;Error building header
- +36 SET HLERROR="4^Unable to build message header => "_TMP
- +37 DO STATUS^HLTF0(HLMTIENS,4,0,$PIECE(HLERROR,"^",2))
- End DoDot:1
- if (HLERROR)
- QUIT
- +38 ;Build batch header (BHS or FHS)
- +39 IF (HDR2BLD'="M")
- Begin DoDot:1
- +40 SET TMP=""
- +41 DO BHSHDR^HLCSHDR(HLMTIENS)
- +42 if ($EXTRACT(HLHDR(1),1)="-")
- SET TMP=$PIECE(HLHDR(1),"^",2)
- +43 if (TMP="")
- QUIT
- +44 ;Error building header
- +45 SET HLERROR="4^Unable to build batch header => "_TMP
- +46 DO STATUS^HLTF0(HLMTIENS,4,0,$PIECE(HLERROR,"^",2))
- End DoDot:1
- if (HLERROR)
- QUIT
- +47 ;Create entry for 'incoming' message
- +48 DO CREATE^HLTF(.MSGID,.HLMSGPTR,.MSGDT,.MSGDTH)
- +49 ;Move header and rest of message into 'incoming' message
- +50 IF (HDR2BLD="M")
- Begin DoDot:1
- +51 ;Use MSH as header
- +52 DO MRGINT^HLTF1(HLMTIEN,HLMSGPTR,"HLHDR")
- End DoDot:1
- +53 IF (HDR2BLD'="M")
- Begin DoDot:1
- +54 ;Use BHS or FHS as header
- +55 DO MRGINT^HLTF1(HLMTIEN,HLMSGPTR,"BHSHDR")
- End DoDot:1
- +56 ;Set status of outgoing message to AWAITING ACKNOWLEDGEMENT
- +57 DO STATUS^HLTF0(HLMTIENS,$SELECT($PIECE(^HL(772,HLMTIEN,0),U,7):3,1:2))
- +58 ;Set status of 'incoming' message to AWAITING PROCESSING
- +59 DO STATUS^HLTF0(HLMSGPTR,9)
- +60 QUIT
- SENDACK(HLMTIENA,HLEID,HLEIDS,HLRESULT) ;Send an HL7 acknowledgement/response
- +1 ;HLMTIENA=The IEN of the parent acknowledgment/response message in
- +2 ; file # 772
- +3 ;HLEIDS=The IEN of the Subscribing protocol in file # 101
- +4 ;HLEID=The IEN of the Event Driver protocol in file #101
- +5 ;HLRESULT=Variable for any error text (pass by reference)
- +6 ;
- +7 NEW HLERROR,HLOGLINK,HLCLIENT,HLMTIENS,HLMSGPTR,HLCLNODE
- +8 IF $GET(HLMTIENA)=""!($GET(HLEID)="")!($GET(HLEIDS)="")
- SET HLERROR="0^7^"_$GET(^HL(771.7,7,0))_"at SENDACK^HLCS entry point"
- GOTO EXIT2
- +9 SET HLCLNODE=$GET(^ORD(101,HLEID,770))
- +10 ;Get pointers to Logical Link & receiving application
- +11 SET HLOGLINK=$PIECE($GET(^ORD(101,HLEIDS,770)),U,7)
- +12 ;Application needed to dynamically address the ACK (tcp/ip)
- +13 ;(set HLL("LINKS") array before calling GENACK)
- +14 IF $DATA(HLL("LINKS"))
- Begin DoDot:1
- +15 SET HLOGLINK=$PIECE(HLL("LINKS",1),"^",2)
- if HLOGLINK=""
- QUIT
- +16 KILL HLL("LINKS")
- +17 IF +HLOGLINK'=HLOGLINK
- SET HLOGLINK=$ORDER(^HLCS(870,"B",HLOGLINK,0))
- End DoDot:1
- if 'HLOGLINK
- QUIT
- +18 SET HLCLIENT=$PIECE(HLCLNODE,U,1)
- +19 if ('HLCLIENT)
- QUIT
- +20 ;Determine if receiving application is internal or external
- +21 ; Logical link has a value for external applications
- +22 ; Logical link is NULL for internal applications
- +23 IF (HLOGLINK)
- DO COTSACK
- QUIT
- +24 ;Create 'incoming' message based on 'outgoing' message (internal)
- +25 DO DHCP(HLMTIENA,HLEID,HLCLIENT)
- +26 ;Process the 'incoming' message
- +27 IF (HLMSGPTR)
- Begin DoDot:1
- +28 SET HLERROR=""
- +29 DO PROCESS^HLTP0(HLMSGPTR,"DHCP","",.HLERROR)
- End DoDot:1
- +30 ;Update Status of 'incoming' message to SUCCESSFULLY COMPLETED
- +31 ; or ERROR DURING TRANSMISSION
- +32 DO STATUS^HLTF0(HLMSGPTR,$SELECT(HLERROR:4,1:3),$SELECT(HLERROR:+HLERROR,1:""),$SELECT(HLERROR:$PIECE(HLERROR,"^",2),1:""))
- EXIT2 ;
- +1 SET HLRESULT=$GET(HLERROR)
- +2 QUIT
- COTSACK ;Internal to external communication of acknowledgements/responses
- +1 ;Create child entry in Message Text file
- +2 DO SEND^HLMA2(HLEID,HLMTIENA,HLCLIENT,"D",.HLMTIENS,HLOGLINK)
- +3 ;'Pass' message to background filer by setting status of child
- +4 ; to PENDING TRANSMISSION
- +5 DO STATUS^HLTF0(HLMTIENS,1)
- +6 QUIT