There are two huge files, let's say FILEA and FILEB.
Objective is:
1) Read FILEA first and if the same record is found in FILEB, write it into FILE01 and if not found write it into FILE02. This process has to continue till the end-of-file of FILEA.
2) Once FILEA completely read, then write a line full of ' ***** ' in FILE01 as well as FILE02
3) Then start reading FILEB and find the record in FILEA. If found write into FILE01, not found write into FILE02. Continue till end-of-file of FILEB.
Interviewer asked me to write a cobol code (just structure) to achieve the above - I have written the lengthy approach first -
Sort FILEA, FILEB
Read FILEA, Find in FILEB
Write to FILE01/FILE02.
He agreed that it will give appropriate result but would be very inefficient taking long time as records may be millions.
Kindly suggest how to achieve the above efficiently. (using JCL and COBOL only).