source: FOIAVistA/tag/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/VAFHLMFE.m@ 636

Last change on this file since 636 was 628, checked in by George Lilly, 14 years ago

initial load of FOIAVistA 6/30/08 version

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