I have been asked to write program to process 2 input files (customer and employee), matching the keys of both files and producing the following 3 output files:
- File-1: records that are on both files
- File-2: records that are on the customer file but not the employee file
- File-3: records that are on the employee file but not the customer file
My loop is set so that it checks one record in customer file against every record in the employee file and then gets another key-pair value from the customer file and starts the process over.
Currently:
- Matching Records - Must be in File1 and File2 (This works)
- Records that are in File1 but not in File2 (Not working)
- Records that are in File2 but not in File1 (Not working)
Questions: Is there a way to use the same read paragraphs as I have currently to accomplish all of my tasks at one time, without having to rerun the JCL for each file compare type
The code that I have posted works for ONLY the matching case
Code: (Record Layout -- This all works)
01 MAIN-LINE1.
05 FILLER PIC X(03). <-- won't use in comparison
05 ID-1 PIC X(09).
05 FILLER PIC X(01).
05 KEY-1 PIC X(20).
05 FILLER PIC X(47).
01 MAIN-LINE2.
05 ID-2 PIC X(09).
05 FILLER PIC X(55).
05 KEY-2 PIC X(20).
05 FILLER PIC X(66).
Read statements below. This is called from one Perform Match-Infile1... which does work.
This code below works for a Matching situation in the files.
MATCH-INFILE1.
READ INFILE1 INTO MAIN-LINE1
AT END
MOVE 'Y' TO EOF1
GO TO X-INFILE1
NOT AT END
PERFORM READ-INFILE2 THRU X-INFILE2 UNTIL EOF2 = 'Y'
END-READ.
X-INFILE1. EXIT.
READ-INFILE2.
READ INFILE2 INTO MAIN-LINE2
AT END
MOVE 'Y' TO EOF2
GO TO X-INFILE2
NOT AT END
PERFORM COMP-FILE THRU X-COMP-FILE <-- I did not include this because
I forgot to but can add it in in
the morning when I have access
to the mainframe. (simple compare)
END-READ.
X-INFILE2. EXIT.
Record Layout
Customer Layout:
**107458982** ****FM00000000000713432****CH <-- discard the CH
Employee Layout: (discard the SD two byte fields)
SD **331067113** **FFM00000000004556402**