Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: MHV7B10

MHV7B10.m

Go to the documentation of this file.
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
 ;