Page 1 of 1

Easytrieve Job Input statement query

Posted: Wed Oct 03, 2012 7:28 pm
by Pank.kumar
Hi All,

I am new to Easytrieve and have some issue in Easytrieve Job Input statement. I have a code as:

Code: Select all

JOB INPUT (A KEY(K1 K2) B KEY(K3 K4)) NAME A-JOB

IF A
   <statement1> 
   IF B
       <statement2> 
   ELSE
   END-IF
ELSE
   IF DUPLICATE B
        <statement3> 
   ELSE
       <statement4> 
   END-IF
END-IF
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.
Pankaj

Re: Easytrieve Job Input statement query

Posted: Wed Oct 03, 2012 8:17 pm
by William Collins
If you use the matched file processing, you should use the special conditions which are available with it. Consult your documentation.

I'd not like to say what the code does, as I've never tried it like that.

What's with the "spare" ELSE?

Do you have duplicate key combinations on either file? I'm guessing yes, from the DUPLICATE, but if you have duplicates on both the above code will definitely get you in a mess.

Posted: Thu Oct 04, 2012 12:05 am
by DikDude
Suggest you make up some test data that represents the data patterns / combinations that might exist in the "real" input file and run the code.

Keep track of what happens in each case (no dup, dup, multi-dup, nomatch, etc) and post back here with the results and any questions that might arise.

Posted: Thu Oct 04, 2012 12:57 am
by Pank.kumar
@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 :(.

Posted: Thu Oct 04, 2012 1:07 am
by DikDude
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.

Posted: Thu Oct 04, 2012 2:13 am
by William Collins
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.