INTSUSN1 ;JD; 28 Jun 96 19:22; processing functions and utilities
;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
;COPYRIGHT 1991-2000 SAIC
;
VERIF(INGBL,INMSH,INTYP,INEVN,INERR) ;Determine HL7 message type and event
;INPUT
;--INGBL = global being checked, can be ^INTHU
;--------If numeric, assumed to be IEN for ^INTHU
;--------If non-numeric, assumed to be global reference
;--INMSH = variable for MSH segment (Pass by reference)
;--INTYP = Message type in format (PBR)
;--INEVN = Trigger event (PBR)
;--INERR = error message array (PBR)
;RETURN
;0=success 1=failure 2=fatal error
N LCT,EVN,TYPE
I +INGBL S LCT=0 D GETLINE^INHOU(INGBL,.LCT,.INMSH)
I 'INGBL S INMSH=$G(@INGBL@(1))
I $E(INMSH,1,3)'="MSH" S MSG(1)="Message from receiver Test Utility does not have the MSH segment in the correct location",MSG(2)=$E(INMSH,1,250) D ERRADD^INHUSEN3(.INERR,.MSG) Q 2
S INDELIM=$E(INMSH,4),INSUBDEL=$E(INMSH,5)
D
. ;First get message type from MSH-9. Trigger Event may be
. ;second component of type.
. S TYPE=$P(INMSH,INDELIM,9) S INEVN=$P(TYPE,INSUBDEL,2),INTYP=$P(TYPE,INSUBDEL) Q:$L(INEVN)
. ;If no EVENT, check for EVN segment in next 5 lines
. I INGBL F I=1:1:5 D Q:$L(INEVN)
.. D GETLINE^INHOU(INGBL,.LCT,.EVN)
.. S:$P(EVN,INDELIM)="EVN" INEVN=$P(EVN,INDELIM,2)
. I 'INGBL F I=2:1:5 D Q:$L(INEVN)
.. S EVN=$G(@INGBL@(I))
.. S:$P(EVN,INDELIM)="EVN" INEVN=$P(EVN,INDELIM,2)
Q 0
;
INTSUSN1 ;JD; 28 Jun 96 19:22; processing functions and utilities
+1 ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
+2 ;COPYRIGHT 1991-2000 SAIC
+3 ;
VERIF(INGBL,INMSH,INTYP,INEVN,INERR) ;Determine HL7 message type and event
+1 ;INPUT
+2 ;--INGBL = global being checked, can be ^INTHU
+3 ;--------If numeric, assumed to be IEN for ^INTHU
+4 ;--------If non-numeric, assumed to be global reference
+5 ;--INMSH = variable for MSH segment (Pass by reference)
+6 ;--INTYP = Message type in format (PBR)
+7 ;--INEVN = Trigger event (PBR)
+8 ;--INERR = error message array (PBR)
+9 ;RETURN
+10 ;0=success 1=failure 2=fatal error
+11 NEW LCT,EVN,TYPE
+12 IF +INGBL
SET LCT=0
DO GETLINE^INHOU(INGBL,.LCT,.INMSH)
+13 IF 'INGBL
SET INMSH=$GET(@INGBL@(1))
+14 IF $EXTRACT(INMSH,1,3)'="MSH"
SET MSG(1)="Message from receiver Test Utility does not have the MSH segment in the correct location"
SET MSG(2)=$EXTRACT(INMSH,1,250)
DO ERRADD^INHUSEN3(.INERR,.MSG)
QUIT 2
+15 SET INDELIM=$EXTRACT(INMSH,4)
SET INSUBDEL=$EXTRACT(INMSH,5)
+16 Begin DoDot:1
+17 ;First get message type from MSH-9. Trigger Event may be
+18 ;second component of type.
+19 SET TYPE=$PIECE(INMSH,INDELIM,9)
SET INEVN=$PIECE(TYPE,INSUBDEL,2)
SET INTYP=$PIECE(TYPE,INSUBDEL)
IF $LENGTH(INEVN)
QUIT
+20 ;If no EVENT, check for EVN segment in next 5 lines
+21 IF INGBL
FOR I=1:1:5
Begin DoDot:2
+22 DO GETLINE^INHOU(INGBL,.LCT,.EVN)
+23 IF $PIECE(EVN,INDELIM)="EVN"
SET INEVN=$PIECE(EVN,INDELIM,2)
End DoDot:2
IF $LENGTH(INEVN)
QUIT
+24 IF 'INGBL
FOR I=2:1:5
Begin DoDot:2
+25 SET EVN=$GET(@INGBL@(I))
+26 IF $PIECE(EVN,INDELIM)="EVN"
SET INEVN=$PIECE(EVN,INDELIM,2)
End DoDot:2
IF $LENGTH(INEVN)
QUIT
End DoDot:1
+27 QUIT 0
+28 ;