Easytrieve Job Input statement query

Ask/Clarify the questions on EASYTRIEVE

Moderators: DikDude, Moderator Group

Post Reply
Pank.kumar
Member
Posts: 2
Joined: Wed Oct 03, 2012 6:59 pm

Easytrieve Job Input statement query

Post by Pank.kumar » Wed Oct 03, 2012 7:28 pm

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

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Re: Easytrieve Job Input statement query

Post by William Collins » Wed Oct 03, 2012 8:17 pm

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.

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Thu Oct 04, 2012 12:05 am

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.
Have a good one

Pank.kumar
Member
Posts: 2
Joined: Wed Oct 03, 2012 6:59 pm

Post by Pank.kumar » Thu Oct 04, 2012 12:57 am

@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 :(.

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Thu Oct 04, 2012 1:07 am

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.
Have a good one

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Thu Oct 04, 2012 2:13 am

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.

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others