I am having 2 files (File-1 and File-2). File-2 is having header part on the top (system date and other info). I have to extract the header part and match both the files on customer-id. The File-1 and File-2 is coming in sorted order.
I have tried 1 logic before procedure division:
SORT FILE-2 to S-FILE-2 +
USING (FILE-2 key) +
BEFORE HDR-EXTRACT para
But as my File-2 is coming in sorted order I can't use this logic.
Joined: 27 Oct 2009 Posts: 2442 Location: Netherlands, Amstelveen
Try this :
JOB INPUT(FILE-1 KEY(F1KEY) FILE-2 KEY(F2KEY))
* your matched processing goes here
IF NOT MATCHED
IF FILE-2 AND FILE-2:RECORD-COUNT = 1
* your header record processing goes here
I have got the solution. I kept 2 JOB INPUT syntax inside the Procedure division.
1) First JOB INPUT will read the FILE-2 and extract the header
2) Second JOB syntax will match FILE-1 and FILE-2 on base of key. Now file-2 is having only detail records without header.
Thank you for ur solution. But i was late to read your reply. Sorry i have already done my coding and testing. Ya but I will try ur solution once.