I have 3 files . 2 files have millions of records.These 2 files have one ( empnumber) common record field. i want to put those records in 3rd file , such that which records having same number in key field (empnumber)in these two files ?

How will you write a logic for this in cobol?

One way is:

Read file1 until EOF1 or EOF2
Read File2 Until EOF2 or File1-Key >File2-key
If File1-key = File2-key
Write .....
End-If
End-Read
End-Read.


But READ stmt dont have UNTIL.
So it is to be done thru PERFORM stmt.
Can u write a full logic in cobol?

/* This question was asked by savvy */