Converting COBOL OCCURS to DFSORT



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Converting COBOL OCCURS to DFSORT

Postby Aki88 » Tue May 26, 2015 1:07 pm

Hello,

I have a requirement to generate a report, input to which is a VSAM file, key length=8; having 'n' records in it.
The report data is present uniquely on 1 record (only); this particular record has 400 occurances, each of length '54'.

I can build the report by individually passing the offsets for all the occurances, and thereby culling data from each occurance.
The challenge here is the length of the resulting SORT card, and if the occurances increase, that would mean piling onto the already large card.

My query is, is there an intrinsic function in DFSORT which would facilitate in these kind of situations where data has to be culled from such repetitive instances; thereby removing the need of giving the individual offset of each of the occurance bit - since the length of fixed data and the number of occurances, both are going to remain a constant - the only variable here being the offset of each occurance.

Thank you.
Aki88
 
Posts: 377
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 36 times

Re: Converting COBOL OCCURS to DFSORT

 

Re: Converting COBOL OCCURS to DFSORT

Postby BillyBoyo » Tue May 26, 2015 2:26 pm

We know you don't have DFSORT 2.1, which has 1,000 PARSE fields available and with a REPEAT for PARSE.

So, no.

Whether 2.1 would help you so much depends on the output you want.

Again, depending on that, you may get somewhere with RESIZE.

But we'd need to see what output you need...
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Converting COBOL OCCURS to DFSORT

Postby Aki88 » Tue May 26, 2015 2:34 pm

Hello Billy,

Thank you for the inputs.

Here is a sample COBOL layout:


<VSAM File Key definition>
-----
----
---- (subsequently)
03  XXXX-YYYY-ZZZZ-DESC.
  05  AAAA-BBBB-CCCC                OCCURS 400 TIMES
                                      INDEXED BY     
                                      X-INDEX-ELEMENT.
      07  AAAA-BBBB-DESCRIPTION-10                       
                      PIC  X(10).                     
      07  AAAA-BBBB-DESCRIPTION-25                       
                      PIC  X(25).               


The expected output is as below; as can be seen it is a simple breakdown of input data:

1:<VSAM File Key> 9:2X 11: <1st Occurance of 35 bits>
1:<VSAM File Key> 9:2X 11: <2nd Occurance of 35 bits>
----
----
----
1:<VSAM File Key> 9:2X 11: <400th Occurance of 35 bits>


This is a generalized form of the expected output.
Hope this is what you're looking for.

Thanks.
Aki88
 
Posts: 377
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 36 times

Re: Converting COBOL OCCURS to DFSORT

Postby BillyBoyo » Tue May 26, 2015 4:03 pm

On that so far, I think RESIZE will work well for you.

RESIZE from (400*35)+35 to 35, and have a USING(...)


In the ....CNTL file for the USING:

Use OMIT COND/INCLUDE COND to only get the records you want.
Use INREC to format the data so it has 35 bytes containing 'KEY=', the key, padded with blanks, then the 400 occurences.

RESIZE will then do its work and you'll get 401 records, some with blanks where there was no data in the occurence (unless all are used).

Use OUTFIL to OMIT= blank records, and produce the report, using WHEN=GROUP with BEGIN= (for the 'KEY=') to PUSH the key onto all the following records. Slightly tacky is what to do with that key record on the report. Either blank it out, or do it in two steps, with OMIT COND for those records in the second step. Or think of something neater :-)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Converting COBOL OCCURS to DFSORT

Postby Aki88 » Tue May 26, 2015 4:15 pm

Hello Billy,

Thank you; I tried a quick RESIZE, and the output is promising; will add the remaining functions to tailor it.

This is way better than a 100 line junked up SORT card with numbers everywhere :)

Best Regards.
Aki88
 
Posts: 377
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 36 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post