EASYTRIEVE Occurs Depending



Unicenter CA-Easytrieve Plus Report Generator: CA's information retrieval and data management tool

EASYTRIEVE Occurs Depending

Postby nanduchowdary » Mon Mar 25, 2013 11:58 am

HI All,

Could some one help me on coding cobol equivalent "Occurs depending on" in a Easytrieve copybook.

The format is as mentioned below :

05 NUM-ACC PIC 9(02) VALUE ZEROES.
05 NUM-DEN-CODE PIC 9(02) VALUE ZEROES.

05 ACC-DIS OCCURS 1 TO 10 TIMES DEPENDING ON NUM-ACC
10 ACC-NARR PIC X(50) VALUE SPACES.
05 DEN-CODE OCCURS 1 TO 5 TIMES DEPENDING ON NUM-DEN-CODE
10 DEN-RSN-CD PIC X(02) VALUE SPACES.

Note : These are not the last fields in the copybook.

Thanks in advance
nanduchowdary
 
Posts: 4
Joined: Mon Mar 25, 2013 11:34 am
Has thanked: 2 times
Been thanked: 0 time

Re: EASYTRIEVE Occurs Depending

Postby BillyBoyo » Mon Mar 25, 2013 1:11 pm

Well, that is maybe going to cause you a problem. I don't have the latest documentation, so you'll have to check yours, but Easytrieve Plus didn't used to support "occurs depending on" definitions. With no data following, not a problem (just use OCCURS). With data following, problematic.

Can you post your Cobol record-layout please?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: EASYTRIEVE Occurs Depending

Postby nanduchowdary » Mon Mar 25, 2013 3:31 pm

Hi Billy,

Thanks for your timely reply & Please find the Cobol Copybook structure below

********************************************************
* VARIABLE SEGMENT COUNTERS *
********************************************************
05 NUM-ACC PIC 9(02) VALUE ZEROES.
05 NUM-DEN-CODE PIC 9(02) VALUE ZEROES.
05 NUM-DEN-NARR PIC 9(02) VALUE ZEROES.
05 NUM-MNG-ORG PIC 9(02) VALUE ZEROES.
05 NUM-WITNESS PIC 9(02) VALUE ZEROES.

********************************************************
* VARIABLE SEGMENT STARTS HERE *
********************************************************
05 ACC-DIS OCCURS 1 TO 10 TIMES DEPENDING ON NUM-ACC
10 ACC-NARR PIC X(50) VALUE SPACES.
05 DEN-CODE OCCURS 1 TO 5 TIMES DEPENDING ON NUM-DEN-CODE
10 DEN-RSN-CD PIC X(02) VALUE SPACES.
05 DEN-NARR OCCURS 1 TO 3 TIMES DEPENDING ON NUM-DEN-NARR
10 DEN-RSN-NARR PIC X(50) VALUE SPACES.
05 MNG-ORG OCCURS 1 TO 2 TIMES DEPENDING ON NUM-MNG-ORG
10 MNG-ORG-CODE PIC X(02) VALUE SPACES.
10 MNG-ORG-NAME PIC X(40) VALUE SPACES.
10 MNG-ORG-NO PIC X(09) VALUE SPACES.
05 FILLER PIC X(20) VALUE SPACES.
05 WITNESS OCCURS 1 TO 5 TIMES DEPENDING ON NUM-WITNESS
10 WITNESS-NAME PIC X(40) VALUE SPACES.
10 WITNESS-PHONE-NO PIC X(15) VALUE SPACES.
05 FILLER PIC X(20) VALUE SPACES.

Thanks in advance
nanduchowdary
 
Posts: 4
Joined: Mon Mar 25, 2013 11:34 am
Has thanked: 2 times
Been thanked: 0 time

Re: EASYTRIEVE Occurs Depending

Postby BillyBoyo » Mon Mar 25, 2013 3:47 pm

That's not a good use of OCCURS DEPENDING ON. Those could all have been fixed-length OCCURS without any major storage problem, and by using ODO the processing of the data is forever complicated.

Try to find out whether the record can be changed. Likely you'll be told No, as someone who doesn't really know enough will think that the ODOs are "vital".

You have three choices with Easytrieve Plus

  1. Use MOVE to put the OCCURS data into W definitions with OCCURS which matches the record
  2. Use a MODIFY FILE EXIT to present the data to your program in fixed-length OCCURS (this is not as difficult as it may sound)
  3. Choose another language (Cobol, most likely)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: EASYTRIEVE Occurs Depending

Postby nanduchowdary » Mon Mar 25, 2013 4:14 pm

Hi Billy,

This is actually a requirement from the external agency.
We have to report the data in this format to a external agency. We are reporting 2 records for one transaction.
1.The first record is a fixed length record with basic information.
2.The second record is a variable length record with the detailed information.

I suppose they are using some other language at their end and thus they must have designed the layout as is.
I am already coding the Cobol part and I am asked to code the copybooks for EZT too.

As you suggested with the choices...
1."Use MOVE to put the OCCURS data into W definitions with OCCURS which matches the record"
** I will try this.
2."Use a MODIFY FILE EXIT to present the data to your program in fixed-length OCCURS (this is not as difficult as it may sound)"
** I did not understand this. If possible could you give an example for the same.

Thanks in advance
nanduchowdary
 
Posts: 4
Joined: Mon Mar 25, 2013 11:34 am
Has thanked: 2 times
Been thanked: 0 time

Re: EASYTRIEVE Occurs Depending

Postby BillyBoyo » Mon Mar 25, 2013 4:31 pm

Okay, so the external people are nuts, and you're even less likely to get it changed :-)

The layout cannot be coded in Easytrieve Plus. You can, in a somewhat obscure way (with MOVE) get the data into the record in the format wanted, and there are probably another couple of ways, but not particularly easy to understand or maintain.

The simplest thing to do is the Cobol FILE EXIT.

Here, http://ibmmainframes.com/about60625.html, is an example of an EXIT. It is not exactly what you want, but has the basic stuff you need.

Since you are producing output, it might be easier to do a plain FILE EXIT. This is a program, which can be written in Cobol, which Easytrieve Plus passes each output record. The EXIT can then do some "formatting" and write the final record, then return to Easytrieve Plus.

The "formatting" in your case would be to turn the fixed-length multiple OCCURS which you can define in Easytrieve Plus to the multiple ODO, which you can't, and write the record to the output file.

These users thanked the author BillyBoyo for the post:
nanduchowdary (Tue Apr 02, 2013 5:58 pm)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: EASYTRIEVE Occurs Depending

Postby nanduchowdary » Mon Mar 25, 2013 5:01 pm

Thanks Billy,

I Will work on it and will get back to you if I face any issues. (as this is a project, I have some time to figure out).

Thanks a lot.
nanduchowdary
 
Posts: 4
Joined: Mon Mar 25, 2013 11:34 am
Has thanked: 2 times
Been thanked: 0 time

Re: EASYTRIEVE Occurs Depending

Postby dick scherrer » Mon Mar 25, 2013 8:29 pm

Hello and welcome to the forum,

Currently, Easytrieve will support multi-dimensional arrays.

Which release of Easytrieve are you using?
Hope this helps,
d.sch.

These users thanked the author dick scherrer for the post:
nanduchowdary (Tue Apr 02, 2013 5:58 pm)
User avatar
dick scherrer
Global moderator
 
Posts: 6269
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: EASYTRIEVE Occurs Depending

Postby BillyBoyo » Mon Mar 25, 2013 8:40 pm

Hello Dick,

These are variable-length "arrays". Does Easytrieve Plus yet support those? IE, the OCCURS DEPENDING ON from the Cobol code posted.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: EASYTRIEVE Occurs Depending

Postby dick scherrer » Mon Mar 25, 2013 10:30 pm

Hi Bill,

I don't know if these are supported yet. Once upon a time we used to "fake it" by using fixed-length definitions and only allowing the use of the number of vairable entries ("depending on" value) that were proper for that iteration thru the code.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6269
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Next

Return to CA-Easytrieve

 


  • Related topics
    Replies
    Views
    Last post