View previous topic :: View next topic
Author
Message
vissubhai New User Joined: 07 Nov 2007Posts: 12 Location: Hyderabad
Hi All..
I have a small requirement. I have different kinds of files with different record layouts. But the key for these files is present in the same location.(Starting 2 positions)
The key field is of 3 byte ZD field.
Now I want to split a file based on the following logic:
Divide the key field by 3 and based on the remainder move that record to the files accordingly.
That is if the remainder is 0, move the record to file1,
if remainder is 1, move the record to file 2 and
if remainder is 2, move the record to file 3.
Lets say for example my input file is a FB with LRECL=80 and the input records are as follows:
120AAAAAA
121ABCDEF
122BCDEFG
123UUUUUU
124IIIIIIIII
125QQQQQ
The three output files should be like:
Output 1
120AAAAAA
123UUUUUU
Output 2
121ABCDEF
124IIIIIIIII
Output 3
122BCDEFG
125QQQQQ
Also the same sort card should be used for other files with different record-lengths like FB with LRECL=8000 or 900 etc.
Please let me know if the requirement is not clear.
Vissubhai
Back to top
Alissa Margulies SYNCSORT Support Joined: 25 Jul 2007Posts: 496 Location: USA
vissubhai ,
SORTIN can consist of concatenated data sets, but if the data sets are fixed-length, they must all have the same LRECL.
Back to top
vissubhai New User Joined: 07 Nov 2007Posts: 12 Location: Hyderabad
Alissa,
My requirement is can I have only one sort card for different files.
SORTIN will have only One input file and will have SORTOF01, SORTOF02, SORTOF03 files with record length same as of input file.
That is I have different JCLs for different files but wanted to use the same sortcard for them.
Let me know if I am not clear.
Thanks,
Vissubhai
Back to top
Alissa Margulies SYNCSORT Support Joined: 25 Jul 2007Posts: 496 Location: USA
With FB data, the LRECL needs to be coded accordingly in the inrec/outrec statements, as follows:
Code:
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
120AAAAAA
121ABCDEF
122BCDEFG
123UUUUUU
124IIIIIIIII
125QQQQQ
//SORTOF01 DD DSN=OUTPUT.REMAIN0
//SORTOF02 DD DSN=OUTPUT.REMAIN1
//SORTOF03 DD DSN=OUTPUT.REMAIN2
//SYSIN DD *
INREC FIELDS=(1,80,1,3,ZD,MOD,+3,M11,LENGTH=1)
SORT FIELDS=COPY
OUTFIL FILES=01,INCLUDE=(81,1,ZD,EQ,0),OUTREC=(1,80)
OUTFIL FILES=02,INCLUDE=(81,1,ZD,EQ,1),OUTREC=(1,80)
OUTFIL FILES=03,INCLUDE=(81,1,ZD,EQ,2),OUTREC=(1,80)
/*
If your data were VB, then you could modify the job to standardize it for any LRECL:
Code:
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=INPUT.VB,DISP=SHR
//SORTOF01 DD DSN=OUTPUT.REMAIN0
//SORTOF02 DD DSN=OUTPUT.REMAIN1
//SORTOF03 DD DSN=OUTPUT.REMAIN2
//SYSIN DD *
INREC FIELDS=(1,4,5,3,ZD,MOD,+3,M11,LENGTH=1,5)
SORT FIELDS=COPY
OUTFIL FILES=01,INCLUDE=(5,1,ZD,EQ,0),OUTREC=(1,4,6)
OUTFIL FILES=02,INCLUDE=(5,1,ZD,EQ,1),OUTREC=(1,4,6)
OUTFIL FILES=03,INCLUDE=(5,1,ZD,EQ,2),OUTREC=(1,4,6)
/*
Back to top
dick scherrer Moderator Emeritus Joined: 23 Nov 2006Posts: 19244 Location: Inside the Matrix
Hello,
Quote:
My requirement is can I have only one sort card for different files.
This "requirement" needs to be changed to "My requirement is I can have only one sort card for different files of the same lrecl".
Possibly i misunderstand and this is only a "want" rather than an actual requirement. . .
Back to top
vissubhai New User Joined: 07 Nov 2007Posts: 12 Location: Hyderabad
Thanks a lot Alissa...
Back to top
Please enable JavaScript!