Page 1 of 1
Two different record length files
Posted: Wed Feb 24, 2010 11:12 pm
by bhaskar.naidu
Hi,
I have a requirement where in a single GDG, I have two versions which is of different record lengths and I need to sort this GDG bases and need to write to an output file with the minimum record length format.
For ex: I have a GDG and it has two versions in it.
The first version has a record length of 100 and the second version has a record length of 120. So, I need to sort these two versions and write to the output file with a record length of 100 where I should extract only 100 bytes of the second version.
I have to do this in a single step of SORT.
Could you please let me know how to do this in SORT.
Thanks,
Bhaskar
Posted: Wed Feb 24, 2010 11:53 pm
by MrSpock
Are these files Fixed Block (FB) or Variable Block (VB)?
Posted: Thu Feb 25, 2010 12:03 am
by bhaskar.naidu
Both the versions are of Fixed Block.
Posted: Thu Feb 25, 2010 10:55 pm
by skolusu
bhaskar.naidu wrote:I have to do this in a single step of SORT.
I don't understand the fascination for doing everything in a single step which in this case can turn out to be quite inefficient. Even though it is a single step , it would actually require 3 passes of data to get the desired results. But using 2 steps it would be just 2 passes of data and this is much more efficient.
Here are the different approaches
Code: Select all
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//FB120 DD DSN=Your input FB120 file,DISP=SHR
//FB100 DD DSN=Your input FB100 file,DISP=SHR
//TEMPF DD DSN=&&TEMPF,DISP=(MOD,PASS),SPACE=(CYL,(X,Y),RLSE)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(FB120) TO(TEMPF) USING(CTL1)
COPY FROM(FB100) TO(TEMPF)
SORT FROM(TEMPF) TO(OUT) USING(CTL2)
//CTL1CNTL DD *
OUTREC BUILD=(1,100)
//CTL2CNTL DD *
SORT FIELDS=(1,10,CH,A)
//*
2 step approach
Code: Select all
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=&&FB120,DISP=SHR
//SORTOUT DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
INREC BUILD=(1,100)
//*
//STEP0200 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=&&FB100,DISP=SHR
// DD DSN=&&T1,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,10,CH,A),EQUALS
//*
Posted: Fri Feb 26, 2010 12:07 am
by bhaskar.naidu
Thanks a lot for your help.
This works for me.
Regards,
Bhaskar
Posted: Sat Feb 27, 2010 1:29 am
by Anuj Dhawan
skolusu wrote:I don't understand the fascination for doing everything in a single step which in this case can turn out to be quite inefficient.
Because they just don't understand the meaning of "how many passes of data are required" - for them, less number of lines in JCL, less the resources!