XUMFMFI ;OIFO-OAK/RAM - HL7 MFI SEGMENT ;8/23/95 [ 07/29/2004 9:01 AM ]
;;8.0;KERNEL;**217**;Jul 10, 1995
;
;routine copied from VAFHLMFI by ALB/CM,JLU
;
;Input Parameters:
;ID - Master File Identifier (required)
;APP - Master File Application Identifier. (required)
;EVENT - File-Level Event Code. If not defined, the default will be "REP" to replace current version of this master file with the version contained in the message.
;ENDT - Entered date/time. If not defined, the default is today. This should be in FM date/time format.
;EFFDT - Effective date/time. If not defined, the default is today. This should be in FM date/time format.
;RESP - Response Level Code. If not defined, will be "NE" Never, No application level response needed.
;
;Output:
;MFI - contains the segment if successful
; - contains -1^error message if unsuccessful
;
MFI(ID,APP,EVENT,ENDT,EFFDT,RESP) ;
;
I '$D(ID)!('$D(APP)) Q "-1^Missing Required Parameter(s)"
I '$D(EVENT) S EVENT="REP"
I '$D(ENDT) D NOW^%DTC S ENDT=$P(%,".") K %
I '$D(EFFDT) D NOW^%DTC S EFFDT=$P(%,".") K %
I '$D(RESP) S RESP="NE"
;
N MFI
S MFI="MFI"_HLFS_ID_HLFS_APP_HLFS_EVENT_HLFS_$$HLDATE^HLFNC(ENDT)_HLFS_$$HLDATE^HLFNC(EFFDT)_HLFS_RESP
Q MFI
;
;
EN(ENC,FS,QUOTS,ARY) ;generic call to create MFI segments.
;
;INPUTS ENC - the encoding characters for the segments
; FS - the field separators to be used
; QUOTS - what to use as double quots
; ARY - this array contains the data to be place in the
; MFI segment. The subscripts of the array should
; be the sequence number of the data element in the
; array.
; Ex. X(1)=master fiel identifier
; X(2)=Master File Application Identifier
; X(3)=File Level Event Code
; etc.
;OUTPUT
; 0^description if there was an error.
; the formatted segment if successful.
;
N SEG,LP
I '$D(ENC)!('$D(FS))!('$D(QUOTS))!('$D(ARY)) S SEG="0^Missing parameters." G MFIQ
I $D(@ARY)<10 S SEG="0^Field array not populated." G MFIQ
S SEG=""
F LP=0:0 S LP=$O(@ARY@(LP)) Q:'LP S $P(SEG,FS,LP+1)=@ARY@(LP)
S $P(SEG,FS,1)="MFI"
MFIQ Q SEG
XUMFMFI ;OIFO-OAK/RAM - HL7 MFI SEGMENT ;8/23/95 [ 07/29/2004 9:01 AM ]
+1 ;;8.0;KERNEL;**217**;Jul 10, 1995
+2 ;
+3 ;routine copied from VAFHLMFI by ALB/CM,JLU
+4 ;
+5 ;Input Parameters:
+6 ;ID - Master File Identifier (required)
+7 ;APP - Master File Application Identifier. (required)
+8 ;EVENT - File-Level Event Code. If not defined, the default will be "REP" to replace current version of this master file with the version contained in the message.
+9 ;ENDT - Entered date/time. If not defined, the default is today. This should be in FM date/time format.
+10 ;EFFDT - Effective date/time. If not defined, the default is today. This should be in FM date/time format.
+11 ;RESP - Response Level Code. If not defined, will be "NE" Never, No application level response needed.
+12 ;
+13 ;Output:
+14 ;MFI - contains the segment if successful
+15 ; - contains -1^error message if unsuccessful
+16 ;
MFI(ID,APP,EVENT,ENDT,EFFDT,RESP) ;
+1 ;
+2 IF '$DATA(ID)!('$DATA(APP))
QUIT "-1^Missing Required Parameter(s)"
+3 IF '$DATA(EVENT)
SET EVENT="REP"
+4 IF '$DATA(ENDT)
DO NOW^%DTC
SET ENDT=$PIECE(%,".")
KILL %
+5 IF '$DATA(EFFDT)
DO NOW^%DTC
SET EFFDT=$PIECE(%,".")
KILL %
+6 IF '$DATA(RESP)
SET RESP="NE"
+7 ;
+8 NEW MFI
+9 SET MFI="MFI"_HLFS_ID_HLFS_APP_HLFS_EVENT_HLFS_$$HLDATE^HLFNC(ENDT)_HLFS_$$HLDATE^HLFNC(EFFDT)_HLFS_RESP
+10 QUIT MFI
+11 ;
+12 ;
EN(ENC,FS,QUOTS,ARY) ;generic call to create MFI segments.
+1 ;
+2 ;INPUTS ENC - the encoding characters for the segments
+3 ; FS - the field separators to be used
+4 ; QUOTS - what to use as double quots
+5 ; ARY - this array contains the data to be place in the
+6 ; MFI segment. The subscripts of the array should
+7 ; be the sequence number of the data element in the
+8 ; array.
+9 ; Ex. X(1)=master fiel identifier
+10 ; X(2)=Master File Application Identifier
+11 ; X(3)=File Level Event Code
+12 ; etc.
+13 ;OUTPUT
+14 ; 0^description if there was an error.
+15 ; the formatted segment if successful.
+16 ;
+17 NEW SEG,LP
+18 IF '$DATA(ENC)!('$DATA(FS))!('$DATA(QUOTS))!('$DATA(ARY))
SET SEG="0^Missing parameters."
GOTO MFIQ
+19 IF $DATA(@ARY)<10
SET SEG="0^Field array not populated."
GOTO MFIQ
+20 SET SEG=""
+21 FOR LP=0:0
SET LP=$ORDER(@ARY@(LP))
IF 'LP
QUIT
SET $PIECE(SEG,FS,LP+1)=@ARY@(LP)
+22 SET $PIECE(SEG,FS,1)="MFI"
MFIQ QUIT SEG