XUMFMFE ;OIFO-OAK/RAM - HL7 MFE SEGMENT ;8/23/95
;;8.0;KERNEL;**217**;Jul 10, 1995
;
;routine copied from VAFHLMFE, written by ALB/CM,JLU
;
MFE(EVENT,MFN,EDT,CODE) ;
;
;Input Parameters:
;EVENT - Record-level Event Code. If not defined, the default is MAD (always add record to master file
;MFN - MFN Control ID. If not defined, the default is null
;EDT - Effective date/time. If not defined, the default is today. This should be in FM date/time format.
;CODE - REQUIRED! Primary Key Value. If not defined, segment will not be built and record will not be sent.
;
;Output:
;MFE - contains the segment if successful
; - contains -1^error message if unsuccessful
;
I '$D(EVENT) S EVENT="MAD"
I '$D(MFN) S MFN=""
I '$D(EDT) D NOW^%DTC S EDT=$P(%,".") K %
I '$D(CODE) S MFE="-1^No Primary Key Value" G EXIT
N MFE
S MFE="MFE"_HLFS_EVENT_HLFS_MFN_HLFS_$$HLDATE^HLFNC(EDT)_HLFS_CODE
EXIT ;
Q MFE
;
EN(ENC,FS,QUOTS,ARY) ;formats the MFE segment
;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
; MFE segment. The subscripts of the array should
; be the sequence number of the data element in the
; array.
; Ex. X(1)=Record Level Event Code
; X(2)=MFN Control ID
; X(3)=Effective Date/time
; 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)="MFE"
MFIQ Q SEG
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HXUMFMFE 1904 printed Dec 13, 2024@02:10:53 Page 2
XUMFMFE ;OIFO-OAK/RAM - HL7 MFE SEGMENT ;8/23/95
+1 ;;8.0;KERNEL;**217**;Jul 10, 1995
+2 ;
+3 ;routine copied from VAFHLMFE, written by ALB/CM,JLU
+4 ;
MFE(EVENT,MFN,EDT,CODE) ;
+1 ;
+2 ;Input Parameters:
+3 ;EVENT - Record-level Event Code. If not defined, the default is MAD (always add record to master file
+4 ;MFN - MFN Control ID. If not defined, the default is null
+5 ;EDT - Effective date/time. If not defined, the default is today. This should be in FM date/time format.
+6 ;CODE - REQUIRED! Primary Key Value. If not defined, segment will not be built and record will not be sent.
+7 ;
+8 ;Output:
+9 ;MFE - contains the segment if successful
+10 ; - contains -1^error message if unsuccessful
+11 ;
+12 IF '$DATA(EVENT)
SET EVENT="MAD"
+13 IF '$DATA(MFN)
SET MFN=""
+14 IF '$DATA(EDT)
DO NOW^%DTC
SET EDT=$PIECE(%,".")
KILL %
+15 IF '$DATA(CODE)
SET MFE="-1^No Primary Key Value"
GOTO EXIT
+16 NEW MFE
+17 SET MFE="MFE"_HLFS_EVENT_HLFS_MFN_HLFS_$$HLDATE^HLFNC(EDT)_HLFS_CODE
EXIT ;
+1 QUIT MFE
+2 ;
EN(ENC,FS,QUOTS,ARY) ;formats the MFE segment
+1 ;INPUTS ENC - the encoding characters for the segments
+2 ; FS - the field separators to be used
+3 ; QUOTS - what to use as double quots
+4 ; ARY - this array contains the data to be place in the
+5 ; MFE segment. The subscripts of the array should
+6 ; be the sequence number of the data element in the
+7 ; array.
+8 ; Ex. X(1)=Record Level Event Code
+9 ; X(2)=MFN Control ID
+10 ; X(3)=Effective Date/time
+11 ; etc.
+12 ;OUTPUT
+13 ; 0^description if there was an error.
+14 ; the formatted segment if successful.
+15 NEW SEG,LP
+16 IF '$DATA(ENC)!('$DATA(FS))!('$DATA(QUOTS))!('$DATA(ARY))
SET SEG="0^Missing parameters."
GOTO MFIQ
+17 IF $DATA(@ARY)<10
SET SEG="0^Field array not populated."
GOTO MFIQ
+18 SET SEG=""
+19 FOR LP=0:0
SET LP=$ORDER(@ARY@(LP))
if 'LP
QUIT
SET $PIECE(SEG,FS,LP+1)=@ARY@(LP)
+20 SET $PIECE(SEG,FS,1)="MFE"
MFIQ QUIT SEG