JOB INPUT (A KEY(K1 K2) B KEY(K3 K4)) NAME A-JOB
IF DUPLICATE B
Can someone please explain to me in which cases statement 1, 2, 3 and 4 will be executed. As far as I know statement 2 gets executed when we have a match of records for file A and B, but not sure about others... Thanks in advance.
@Williams: Thanks for the reply Bill. Well, the requirement is to convert the program written in Easytrieve to Cobol. I understand the use of Matched processing, but if I understand it correctly, in the above code only one case is for Matched processing. Others are not, and that is concerning me.
If I would have to write a code in Easytrieve, I would have definitely used Matched processing, but thats not the case with me, unfortunately .
You need to implement some code just like what you posted as this is the code that needs to be re-written in COBOL. If no one understands exactly how the existing code works, it will be problematic re-writing it.
The time to wonder about how it might work is past. Now, how it DOES work is needed to convert / re-write.
OK. To get your full answer accurately, you're going to have to test that code with some data, as suggested. For the purpose, you can forget the second key. Just do some simple DD * data.
IF A should get all the times that you have a current record on file A. This depends on whether there are duplicates possible on file A or not. And also on duplicates on file B, where you will get the same record on file A multiple times for the "match".
IF B within the IF A should be the matches - excluding duplicates on file A (if those are possible).
The ELSE indicating not on A goes for duplicate records on file B, not matching A, and individual records on file B, not matching A.
But you have to confirm this with your testing.
If there can be duplicates on file A, the code probably doesn't do what the author expected.