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

INHUACK.m

Go to the documentation of this file.
  1. INHUACK ; FRW ; 2 Jul 96 11:32; Handle Incoming ACK messages
  1. ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
  1. ;COPYRIGHT 1991-2000 SAIC
  1. ;;
  1. ;
  1. ACK ;Deal with inbound ack messages
  1. ;INPUT:
  1. ; UIF - ien of ack message in Universal Interface file
  1. ;OUTPUT:
  1. ; INSTERR - if present indicates error occurred
  1. ; INHERR - if present indicates error message
  1. ;
  1. N LCT,LINE,ACKSTAT,ACKEDMES,ERRMSG,INERMSG
  1. ;Start reading lines from the beginning of the message
  1. S LCT=0
  1. ;Get message header
  1. D GET^INHOU(UIF,0)
  1. I '$D(LINE) S INHERR="No message header (MSH) segment" G ERR
  1. S INDELIM=$E(LINE,4),INSUBDEL=$E(LINE,5)
  1. ;Get MSA segment
  1. D GET^INHOU(UIF,0)
  1. ;Check for errors
  1. I $P($G(LINE),INDELIM,1)'="MSA" S INHERR="No message acknowledgement (MSA) segment" G ERR
  1. ;Parse out segment
  1. ;Ack code
  1. S ACKSTAT=$P(LINE,INDELIM,2),ACKSTAT="^AA^CA^"[(U_ACKSTAT_U)
  1. ;ID of Acknowldeged message
  1. S ACKEDMES=$P(LINE,INDELIM,3)
  1. I '$L(ACKEDMES) S INHERR="No message identified to acknowledge" G ERR
  1. I '$D(^INTHU("C",ACKEDMES)) S INHERR="Acknowledge for unknown message ID - "_ACKEDMES G ERR
  1. ;Save any @INV@("MSA6") Error Messages (HL7 V2.3 format)
  1. S INERMSG=$P(LINE,INDELIM,7)
  1. ;Get the first ERR segment
  1. D GET^INHOU(UIF,0)
  1. S ERRMSG=$P($G(LINE),INDELIM,2)
  1. ;Give priority to ERR Segment Error Messages
  1. S:'$L(ERRMSG) ERRMSG=INERMSG
  1. ;Log acknowledge
  1. D ACKLOG^INHU(UIF,ACKEDMES,ACKSTAT,ERRMSG)
  1. ;
  1. Q
  1. ;
  1. ERR ;Error module
  1. S INSTERR=2
  1. Q
  1. ;
  1. NOTES ;Description:
  1. ;This program is called as part of the INCOMING ACK script
  1. ;
  1. ;Issues:
  1. ;Repeating ERR segments are not recognized
  1. ;