I have a doubt regarding handling three files simultaneously inside a cobol program.The program has to generate a report using the three files and these files have the same key.But the records in the files do not have a one to one correspondence.How can we handle them efficiently outside the program ie in a JCl so as to minimize the complexity of the logic?
You didn't say how the rpt was to be written. If all 3 recs are needed to generate a rpt line you can do something like this, provided all 3 files are sorted on the same key.
Code:
Do a priming read of all 3 files.
Perf process-rpt until eof on any file
In process-rpt:
check for all 3 keys equal and save hi key
evaluate true
when 3 keys equal
perf print rpt line
perf read 3 files
when key1 < hi key
perf read file1
when key2 < hi key
perf read file2
when key3 < hi key
perf read file2
end-eval
P.S. This approach will work for 3 or more IP files.