Usage of OUTFIL + VSAM files



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

Usage of OUTFIL + VSAM files

Postby Aki88 » Tue Nov 18, 2014 4:27 pm

Hello,

I have a requirement where I need to split a set of (input) sequential files (which are DD concatenated), thereby writing them to o/p KSDS files.
The problem here is that VSAM files can not be output when OUTFIL is used (ICE224A is the message thrown if attempted); one way of achieving this is by splitting the input files using OUTFIL into 'n' sequential files, and then SORT COPYing/IDCAMS REPROing the split files to KSDS individually. Is there a method using which this can be done in one step only(writing a COBOL program is the last resort).

SORT Card coded (the value of n goes from 00 to 99, all in the same step):

 SORT FIELDS=<Condition>
* FILE FOR SEGMENT <n>                     
 OUTFIL FILES=<n>,REMOVECC,               
 INCLUDE=(18,1,CH,EQ,C'<n>'),BUILD=(1,500),
 HEADER1=(1:500C'0'),                   
 TRAILER1=(1:500C'9')                   
*


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

Re: Usage of OUTFIL + VSAM files

Postby BillyBoyo » Tue Nov 18, 2014 5:08 pm

The message does not indicate that you cannot use OUTFIL, it indicates that you cannot use the reporting functions of OUTFIL (like REMOVECC, HEADER1 and TRAILER1).

What is the purpose of the header and trailer records you want on the KSDSs? I don't see any code to split anything. If you can give more detail...
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Usage of OUTFIL + VSAM files

Postby Aki88 » Tue Nov 18, 2014 5:30 pm

Hi Billy,

Very true, my bad for interpreting it incorrectly.

It is a requirement of the KSDS to have all '0' as the first record and all '9' as the last record. Split might not the right technical term for it, but in the end that is what is being achieved here by selectively writing the o/p records on the basis of the 18th bit.

The way my SORTIN/SORTOUTs appear:
//SORTIN    DD DISP=SHR,DSN=<DSN1>
//          DD DISP=SHR,DSN=<DSN2>
//          DD DISP=SHR,DSN=<DSN3>
---
---
//          DD DISP=SHR,DSN=<DSNn>
---
---
//SORTOF00  DD DSN=<O/P KSDS-DSN1>,DISP=SHR
//*                                                   
//SORTOF01  DD DSN=<O/P KSDS-DSN2>,DISP=SHR
//*                                                   
---
---
//SORTOFnn  DD DSN=<O/P KSDS-DSNn>,DISP=SHR
//*


A sample of the SORT Card is as below, as can be seen, the values in OUTFIL FILES and INCLUDE goes from '0' onwards to 'n', which goes upto 99; same was given in the previous post:

 SORT FIELDS=<Condition>               
* FILE FOR SEGMENT 0                     
 OUTFIL FILES=00,REMOVECC,               
 INCLUDE=(18,1,CH,EQ,C'0'),BUILD=(1,500),
 HEADER1=(1:500C'0'),                   
 TRAILER1=(1:500C'9')                   
*                                       
* FILE FOR SEGMENT 1                     
 OUTFIL FILES=01,REMOVECC,               
 INCLUDE=(18,1,CH,EQ,C'1'),BUILD=(1,500),
 HEADER1=(1:500C'0'),                   
 TRAILER1=(1:500C'9')                   
*



Hope this suffices; kindly let me know in case this is not clear.

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

Re: Usage of OUTFIL + VSAM files

Postby BillyBoyo » Tue Nov 18, 2014 7:36 pm

Get rid of the bits you can't have. Work our how 18,1,CH will map to 00-99.

A KSDS doesn't often have a trailer. If it actually has some genuine purpose, consider REPRO to add those. It'll make your life easier. If the header has a purpose (more normal, date, environment, logical filename) then you can either REPRO those or even do it in OUTFIL using a sequence number to know you have the first record.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Usage of OUTFIL + VSAM files

Postby Aki88 » Tue Nov 18, 2014 8:06 pm

Thank you for the pointers Billy; this SORT card was the solution to a file redesign process (so we'll have to put up with the existing 0s and 9s, as sadly, that is how the client wants the KSDS).
REPRO would be adding another step in the current stream, and I assure you, one REPRO would solve the entire problem for me; provided people here agree to it; things don't always go as per our plan :P

On a more serious note, '18,1,CH' is to segment out my input, that is THE only identifier bit in the data which tells me to which segment does the record belong - from 00 to 99.

From what I understand, it'll require some coding and a lot of data handling in the SORT card (inclusive of at least 1 REPRO step) - kindly correct me if I have it wrong here.
And even if I am able to handle it - I'll have to figure some way out to add the 9s as the last record - without using TRAILER1 in the SORT card --> if I want to write an o/p KSDS.

A COBOL program would be simpler :D

Thanks though, let me put across what I have into a new SORT card (without using the REPRO; if I am allowed to use REPRO then I already have a solution is place), if it works out then will share it here, else COBOL prog will get this done in a jiffy.

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

Re: Usage of OUTFIL + VSAM files

Postby BillyBoyo » Tue Nov 18, 2014 9:15 pm

As long as you are on a fairly recent z/OS, REPRO for a KSDS will likely be faster than SORT. You should compare one segments done each way and look at the IO/CPU for each method.

Identifying the "last" record is possible, but not straightforward. Another simple way would be to have "dummy" headers and trailers on your input, and get those in the INCLUDE= for the OUTFILs. Lots of records, means lots of test, may be one REPRO step doing 100 headers and trailers again gives profit.

The performance of a COBOL program is going to be the worst (nothing personal, it's just the way it is). If you've got something you want to split into 99 segments, I'm assuming it is big. You could knock together an equivalent in COBOL and compare it with the above two. I'd expect the order to be REPRO, SORT, COBOL, but don't quote me :-)

These users thanked the author BillyBoyo for the post:
Aki88 (Tue Nov 18, 2014 11:16 pm)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Usage of OUTFIL + VSAM files

Postby Aki88 » Tue Nov 18, 2014 11:10 pm

Hello Billy,

Finally got it working :D
Final solution:
1. Del/Def all the KSDS in one IDCAMS step.
2. Execute the SORT card (shared earlier in the posts), without the HEADER1/TRAILER1/REMOVECC and build the segmented KSDS files.
3. Execute an IDCAMS REPRO, INFILE being a sequential file with only one record each of 0s and 9s, OUTFILEs being the KSDS built earlier, using IDCAMS REPRO REPLACE.

and bingo (and yes I had to finally settle with that last REPRO of 2 records, no choices left there :( ); like you'd pointed out overall job was indeed fairly quick even with the chunk of records as input.

Thanks a ton for the suggestions.

Cheerio.
Aki88
 
Posts: 381
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