source: WorldVistAEHR/trunk/r/KERNEL-XU-A4A7-USC-XG-XLF-XNOA-XPD-XQ-XVIR-ZI-ZOSF-ZOSV-ZT-ZU-%Z-XIP--XQAB--XUC--XUR--ZIN--ZTED/XUMFMFE.m@ 1766

Last change on this file since 1766 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 1.8 KB
Line 
1XUMFMFE ;OIFO-OAK/RAM - HL7 MFE SEGMENT ;8/23/95
2 ;;8.0;KERNEL;**217**;Jul 10, 1995
3 ;
4 ;routine copied from VAFHLMFE, written by ALB/CM,JLU
5 ;
6MFE(EVENT,MFN,EDT,CODE) ;
7 ;
8 ;Input Parameters:
9 ;EVENT - Record-level Event Code. If not defined, the default is MAD (always add record to master file
10 ;MFN - MFN Control ID. If not defined, the default is null
11 ;EDT - Effective date/time. If not defined, the default is today. This should be in FM date/time format.
12 ;CODE - REQUIRED! Primary Key Value. If not defined, segment will not be built and record will not be sent.
13 ;
14 ;Output:
15 ;MFE - contains the segment if successful
16 ; - contains -1^error message if unsuccessful
17 ;
18 I '$D(EVENT) S EVENT="MAD"
19 I '$D(MFN) S MFN=""
20 I '$D(EDT) D NOW^%DTC S EDT=$P(%,".") K %
21 I '$D(CODE) S MFE="-1^No Primary Key Value" G EXIT
22 N MFE
23 S MFE="MFE"_HLFS_EVENT_HLFS_MFN_HLFS_$$HLDATE^HLFNC(EDT)_HLFS_CODE
24EXIT ;
25 Q MFE
26 ;
27EN(ENC,FS,QUOTS,ARY) ;formats the MFE segment
28 ;INPUTS ENC - the encoding characters for the segments
29 ; FS - the field separators to be used
30 ; QUOTS - what to use as double quots
31 ; ARY - this array contains the data to be place in the
32 ; MFE segment. The subscripts of the array should
33 ; be the sequence number of the data element in the
34 ; array.
35 ; Ex. X(1)=Record Level Event Code
36 ; X(2)=MFN Control ID
37 ; X(3)=Effective Date/time
38 ; etc.
39 ;OUTPUT
40 ; 0^description if there was an error.
41 ; the formatted segment if successful.
42 N SEG,LP
43 I '$D(ENC)!('$D(FS))!('$D(QUOTS))!('$D(ARY)) S SEG="0^Missing parameters." G MFIQ
44 I $D(@ARY)<10 S SEG="0^Field array not populated." G MFIQ
45 S SEG=""
46 F LP=0:0 S LP=$O(@ARY@(LP)) Q:'LP S $P(SEG,FS,LP+1)=@ARY@(LP)
47 S $P(SEG,FS,1)="MFE"
48MFIQ Q SEG
Note: See TracBrowser for help on using the repository browser.