MHV7B10 ;KUM - HL7 message builder SECURE MESSAGING ACK^P03 ; 1/11/15 4:08pm
;;1.0;My HealtheVet;**11**;Aug 23, 2005;Build 61
;;Per VHA Directive 2004-038, this routine should not be modified.
;
Q
;
ACKP03(MSGROOT,QRY,ERR,DATAROOT,LEN,HL) ; Build query response
;
; Populates the array pointed to by MSGROOT with an ACK^P03 query
; response message by calling the appropriate segment builders based
; on the type of response ACK/Data or NAK. Extracted data pointed to
; by DATAROOT, errors, hit counts, and query information are used to
; build the segments.
; An error number in ERR^4 indicates a NAK is needed.
; DATAROOT being null indicates a dataless ACK (testing purposes).
;
; Input:
; MSGROOT - Global root of message
; QRY - Query parameters
; QRY("MID") - original message control ID
; 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: ACK^P03 message in MSGROOT
; LEN - Length of formatted message
;
N CNT,HIT,EXTIME,MTYPE
D LOG^MHVUL2("SM ACK-P03 BUILDER","BEGIN","S","TRACE")
;
S HIT=0,EXTIME=""
I DATAROOT'="" D
. S HIT=+$P($G(@DATAROOT),"^",1)
. S EXTIME=$P($G(@DATAROOT),"^",2)
. Q
S HIT=HIT_"^"_HIT_"^0"
;
K @MSGROOT
S CNT=1,@MSGROOT@(CNT)=$$MSA^MHV7BUS($G(QRY("MID")),ERR,.HL)
S LEN=$L(@MSGROOT@(CNT))
I $P(ERR,"^",4) D
.S CNT=CNT+1,HIT="0^0^0",@MSGROOT@(CNT)=$$ERR^MHV7BUS(ERR,.HL)
.S LEN=LEN+$L(@MSGROOT@(CNT))
;S CNT=CNT+1,@MSGROOT@(CNT)=$$QAK^MHV7BUS(.QRY,ERR,HIT,.HL)
;S LEN=LEN+$L(@MSGROOT@(CNT))
;S CNT=CNT+1,@MSGROOT@(CNT)=$$QPD^MHV7BUS(.QRY,EXTIME,.HL)
;S LEN=LEN+$L(@MSGROOT@(CNT))
;
I '$P(ERR,"^",4) D
.D @(QRY("BUILDER")_"(MSGROOT,DATAROOT,.CNT,.LEN,.HL)")
;
D LOG^MHVUL2("SM ACK-P03 BUILDER","END","S","TRACE")
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMHV7B10 1946 printed Nov 22, 2024@17:25:42 Page 2
MHV7B10 ;KUM - HL7 message builder SECURE MESSAGING ACK^P03 ; 1/11/15 4:08pm
+1 ;;1.0;My HealtheVet;**11**;Aug 23, 2005;Build 61
+2 ;;Per VHA Directive 2004-038, this routine should not be modified.
+3 ;
+4 QUIT
+5 ;
ACKP03(MSGROOT,QRY,ERR,DATAROOT,LEN,HL) ; Build query response
+1 ;
+2 ; Populates the array pointed to by MSGROOT with an ACK^P03 query
+3 ; response message by calling the appropriate segment builders based
+4 ; on the type of response ACK/Data or NAK. Extracted data pointed to
+5 ; by DATAROOT, errors, hit counts, and query information are used to
+6 ; build the segments.
+7 ; An error number in ERR^4 indicates a NAK is needed.
+8 ; DATAROOT being null indicates a dataless ACK (testing purposes).
+9 ;
+10 ; Input:
+11 ; MSGROOT - Global root of message
+12 ; QRY - Query parameters
+13 ; QRY("MID") - original message control ID
+14 ; ERR - Caret delimited error string
+15 ; segment^sequence^field^code^ACK type^error text
+16 ; DATAROOT - Global root of data array
+17 ; HL - HL7 package array variable
+18 ;
+19 ; Output: ACK^P03 message in MSGROOT
+20 ; LEN - Length of formatted message
+21 ;
+22 NEW CNT,HIT,EXTIME,MTYPE
+23 DO LOG^MHVUL2("SM ACK-P03 BUILDER","BEGIN","S","TRACE")
+24 ;
+25 SET HIT=0
SET EXTIME=""
+26 IF DATAROOT'=""
Begin DoDot:1
+27 SET HIT=+$PIECE($GET(@DATAROOT),"^",1)
+28 SET EXTIME=$PIECE($GET(@DATAROOT),"^",2)
+29 QUIT
End DoDot:1
+30 SET HIT=HIT_"^"_HIT_"^0"
+31 ;
+32 KILL @MSGROOT
+33 SET CNT=1
SET @MSGROOT@(CNT)=$$MSA^MHV7BUS($GET(QRY("MID")),ERR,.HL)
+34 SET LEN=$LENGTH(@MSGROOT@(CNT))
+35 IF $PIECE(ERR,"^",4)
Begin DoDot:1
+36 SET CNT=CNT+1
SET HIT="0^0^0"
SET @MSGROOT@(CNT)=$$ERR^MHV7BUS(ERR,.HL)
+37 SET LEN=LEN+$LENGTH(@MSGROOT@(CNT))
End DoDot:1
+38 ;S CNT=CNT+1,@MSGROOT@(CNT)=$$QAK^MHV7BUS(.QRY,ERR,HIT,.HL)
+39 ;S LEN=LEN+$L(@MSGROOT@(CNT))
+40 ;S CNT=CNT+1,@MSGROOT@(CNT)=$$QPD^MHV7BUS(.QRY,EXTIME,.HL)
+41 ;S LEN=LEN+$L(@MSGROOT@(CNT))
+42 ;
+43 IF '$PIECE(ERR,"^",4)
Begin DoDot:1
+44 DO @(QRY("BUILDER")_"(MSGROOT,DATAROOT,.CNT,.LEN,.HL)")
End DoDot:1
+45 ;
+46 DO LOG^MHVUL2("SM ACK-P03 BUILDER","END","S","TRACE")
+47 QUIT
+48 ;