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

HLMA1.m

Go to the documentation of this file.
  1. HLMA1 ;AISC/SAW-Message Administration Module (Cont'd) ;09/13/2006
  1. ;;1.6;HEALTH LEVEL SEVEN;**19,43,91,109,108,133,161**;Oct 13, 1995;Build 6
  1. ;Per VHA Directive 2004-038, this routine should not be modified.
  1. GENACK(HLEID,HLMTIENS,HLEIDS,HLARYTYP,HLFORMAT,HLRESLTA,HLMTIENA,HLP) ;
  1. ;Entry point to generate an acknowledgement message
  1. ;
  1. ;This is a subroutine call with parameter passing. It returns a value
  1. ;in the variable HLRESLTA, however the format of the variable cannot be
  1. ;relied on. Please refer to the developer manual or ICR #2165 for more info.
  1. ;
  1. ;Required Input Parameters
  1. ; HLEID = IEN of event driver protocol from the Protocol file
  1. ; HLMTIENS = IEN of entry in Message Text file for subscriber
  1. ; application
  1. ; HLEIDS = IEN of subscriber event from the Protocol file
  1. ; HLARYTYP = Array type. One of the following codes:
  1. ; LM = local array containing a single message
  1. ; LB = local array containig a batch of messages
  1. ; GM = global array containing a single message
  1. ; GB = global array containing a batch of messages
  1. ; HLFORMAT = Format of array, 1 for pre-formatted in HL7 format,
  1. ; otherwise 0
  1. ;NOTE: The parameter HLRESLTA must be passed by reference
  1. ; HLRESLTA = The variable that will be returned to the calling
  1. ; application as descibed above
  1. ;Optional Parameters
  1. ; HLMTIENA = IEN of entry in Message Text file where the
  1. ; acknowledgement message will be stored. This
  1. ; parameter is only passed for a batch acknowledgment
  1. ; HLP("SECURITY") = A 1 to 40 character string
  1. ; HLP("NAMESPACE") = Passed in by application namespace - HL*1.6*91
  1. ;
  1. ;
  1. ;HLRESLTA is to return the results and should not be initially defined
  1. N HLRESLT
  1. S HLRESLT=""
  1. K HLRESLTA
  1. ;
  1. ;Check for required parameters
  1. I $G(HLEIDS)']""!('$G(HLMTIENS))!($G(HLARYTYP)']"")!($G(HLFORMAT)']"") S HLRESLTA="0^7^"_$G(^HL(771.7,7,0))_" at GENACK^HLMA1 entry point" G EXIT
  1. I 'HLEIDS S HLEIDS=$O(^ORD(101,"B",HLEIDS,0)) I 'HLEIDS S HLRESLTA="0^1^"_$G(^HL(771.7,1,0)) G EXIT
  1. ;Extract data from Protocol file
  1. D EVENT^HLUTIL1(HLEIDS,"15,20,772",.HLN)
  1. N HLEXROU,HLMIDAR
  1. S HLMIDAR=0,HLENROU=$G(HLN(20)),HLEXROU=$G(HLN(15))
  1. S HLP("GROUTINE")=$G(HLN(772)) K HLN I HLP("GROUTINE")']"",'HLFORMAT S HLRESLTA="0^3^"_$G(^HL(771.7,3,0)) G EXIT
  1. I "GL"'[$E($G(HLARYTYP)) S HLRESLTA="0^4^"_$G(^HL(771.7,4,0)) G EXIT
  1. I '$D(HLP("SECURITY")) S HLP("SECURITY")=""
  1. I $L(HLP("SECURITY"))>40 S HLRESLTA="0^6^"_$G(^HL(771.7,6,0)) G EXIT
  1. ;$D(HLTCP) tcp connection will be used
  1. I $D(HLTCP) D GENACK^HLTP4 G EXIT
  1. ;Create message ID and Message Text IEN if Message Text IEN not
  1. ;previously created ('$G(HLMTIENA))
  1. I '$G(HLMTIENA) D CREATE^HLTF(.HLMIDA,.HLMTIENA,.HLDTA,.HLDT1A)
  1. ;Get message ID if Message Text IEN not already created
  1. I '$G(HLMIDA) D
  1. .S HLDTA=$G(^HL(772,HLMTIENA,0))
  1. .S HLDT1A=$$HLDATE^HLFNC(+HLDTA),HLMIDA=$P(HLDTA,"^",6),HLDTA=+HLDTA
  1. S HLRESLTA=HLMIDA,HLP("DTM")=HLDT1A,HLP("DT")=HLDTA,HLP("MTIENS")=HLMTIENS,HLP("EID")=HLEID
  1. ;Execute entry action for subscriber protocol
  1. I HLENROU]"" X HLENROU
  1. ;Invoke transaction processor to generate acknowledgement
  1. K HLDTA,HLDT1A,HLEID,HLENROU,HLMTIENS
  1. S HLRESLT=""
  1. D GENACK^HLTP1(HLMIDA,HLMTIENA,HLEIDS,HLARYTYP,HLFORMAT,.HLRESLT,.HLP)
  1. ;HLMIDAR is array of message IDs, only set for broadcast messages
  1. I HLMIDAR K HLMIDAR("N") M HLRESLTA=HLMIDAR
  1. S HLRESLTA=HLRESLTA_"^"_HLRESLT
  1. ;Update status to Awaiting Acknowledgement or Error in Transmission
  1. D STATUS^HLTF0(HLMTIENA,$S($P(HLRESLTA,"^",2):4,1:3),$S($P(HLRESLTA,"^",2):$P(HLRESLTA,"^",2),1:""),$S($P(HLRESLTA,"^",2):$P(HLRESLTA,"^",3),1:""))
  1. ;Execute exit action for subscriber protocol
  1. X:HLEXROU]"" HLEXROU
  1. EXIT K HLDTA,HLDT1A,HLMIDA,HLENROU,HLEXROU
  1. ;if HLRESLTA is undefined set to NULL ("") HL*1.6*161 RRA ticket #63271
  1. I $G(HLRESLTA)="" S HLRESLTA=""
  1. Q