MHV7T ;WAS/GPM - HL7 TRANSMITTER ; 10/25/05 4:10pm [12/24/07 9:45pm] ;;1.0;My HealtheVet;**2**;Aug 23, 2005;Build 22 ;;Per VHA Directive 2004-038, this routine should not be modified. ; Q ; XMIT(REQ,XMT,ERR,DATAROOT,HL) ;Build and Transmit HL7 message ; Builds and sends the desired HL7 message based on the mode and ; builder passed in XMT. If the builder requires other information ; to build the message, it can be passed as additional subscripts of ; XMT or REQ. REQ is used for request or query related parameters, ; XMT for transmission and control related parameters. ; ; The message builder sent in XMT("BUILDER") is called to build the ; desired message. ; ; A synchronous response is indicated by XMT("MODE") of S, and sent ; on the current interface as an original mode acknowledgement. ; ; An asynchronous response is indicated by XMT("MODE") of A, and ; sent on the interface associated with XMT("PROTOCOL") as an ; enhanced mode application acknowledgement. Large messages can be ; sent as a bolus (series of messages without batch formatting) by ; specifying an XMT("MAX SIZE"). ; ; A message may be initiated by using the asynchronous mode settings ; Synchronous messages cannot be initiated with this API. ; ; Integration Agreements: ; 2161 : INIT^HLFNC2 ; 2164 : GENERATE^HLMA ; 2165 : GENACK^HLMA1 ; ; Input: ; REQ - Request parameters and Message ID of original message ; XMT - Transmission parameters ; XMT("MODE") - Mode of the transmission ; XMT("PROTOCOL") - Protocol for deferred transmissions ; XMT("BUILDER") - Name/tag of message builder routine ; XMT("HLMTIENS") - Original message IEN - Immediate mode ; XMT("MAX SIZE") - Maximum message size (asynch only) ; ERR - Caret delimited error string ; segment^sequence^field^code^ACK type^error text ; DATAROOT - Global root of data array ; HL - HL7 package array variable ; ; Output: HL7 Message Transmitted ; N MSGROOT,HLRSLT,HLP,MSGLEN D LOG^MHVUL2("TRANSMIT","BEGIN","S","TRACE") I XMT("MODE")="A" D ;Asynchronous mode . D LOG^MHVUL2("TRANSMIT","ASYNCHRONOUS","S","TRACE") . K HL . D INIT^HLFNC2(XMT("PROTOCOL"),.HL) . I $G(HL) S ERR=HL D LOG^MHVUL2("PROTOCOL INIT FAILURE",ERR,"S","ERROR") Q . D LOG^MHVUL2("PROTOCOL INIT","DONE "_XMT("MODE"),"S","DEBUG") . S MSGROOT="^TMP(""HLS"",$J)" . D @(XMT("BUILDER")_"(MSGROOT,.REQ,ERR,DATAROOT,.MSGLEN,.HL)") . D LOG^MHVUL2("BUILD "_$P(XMT("BUILDER"),"^"),MSGROOT,"I","DEBUG") . I MSGLEN