View previous topic :: View next topic
|
Author |
Message |
nareshkareti
New User
Joined: 22 Jul 2008 Posts: 33 Location: Chennai
|
|
|
|
Here is my req..
I have an input file in which the data might always change.It has some millions of records and i want that file to be splitted into 10 equal parts.
Can we achieve that in a jcl with sort steps...
Please help. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Have you searched the forum, because this has been asked and answered before.
Please search before posting !!! |
|
Back to top |
|
|
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
Naresh,
Here is a sample SORT application:
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=input.file,...
//SORTOF01 DD DSN=output.file1,...
.
.
.
//SORTOF10 DD DSN=output.file10,...
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FILES=(01,02,03,04,05,06,07,08,09,10),SPLIT
/* |
Hope this helps. |
|
Back to top |
|
|
nareshkareti
New User
Joined: 22 Jul 2008 Posts: 33 Location: Chennai
|
|
|
|
Thanks for the above solution...It is not giving me the reqd output..
I will explain my req with an example..
Consider my input is having 10001 records..i wanted to split into 10 files.So i want first 1000 in file1, next 1000 in file2.........and last 1001 in file10.
If the count is exactly divisible by 10..i can use spliyby...but that is not the case for me...
The record count in the input file always varies and may not be divisible by 10... |
|
Back to top |
|
|
nareshkareti
New User
Joined: 22 Jul 2008 Posts: 33 Location: Chennai
|
|
|
|
i will give few more details on my req...
1.i have to get the record count of the input file
2.divide that by 10
3.give the quotient to the other step where we use SPLITBY function..
can we achieve this in a jcl with 1 r more sort steps.. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Did you run the code Alissa provided?
If not, do so now and post back here what happens and if there is some reason this will not work for your requirement. |
|
Back to top |
|
|
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
Dick,
I believe Naresh is saying that the "round-robin" technique of SPLIT is not what they need, but rather consecutive chunks of records in each OUTFIL... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Alissa,
Yup, you're probably right on - sorry 'bout that. . . |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Naresh,
You can use the technique shown in the "Split a file to n output files dynamically" Smart DFSORT Trick at:
Use [URL] BBCode for External Links
Note that SPLIT1R is a better choice than SPLITBY. |
|
Back to top |
|
|
nareshkareti
New User
Joined: 22 Jul 2008 Posts: 33 Location: Chennai
|
|
|
|
I have searched the forum and built a code according to my req...but giving some error..can anyone pls solve that..
1. i am creating a file with the following string and value generated dynamically.
Code: |
SORT FIELDS=COPY
OUTREC FIELDS=(C' SPLIT1R=',1,15,ZD,DIV,+10,M11,LENGTH=15) |
2. I am giving the above generated file in the following step..
Code: |
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FILES=(01,02,03,04,05,06,07,08,09,10),
// DD DSN=TEST.CNTL.CARD.COUNT,
// DISP=SHR
/* |
the error in the sysout is as follows
Code: |
SYSIN :
SORT FIELDS=COPY
OUTFIL FILES=(01,02,03,04,05,06,07,08,09,10),
SPLIT1R=000000000001000
WER274A CONTINUATION STATEMENT ERROR FOUND
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE |
Edited: Please use BBcode when You post some code/error, that's rather readable, Thanks... Anuj |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
nareshkareti,
SPLIT1R is Supported only by SyncSort 1.3 or later. Are you running an older version? |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
if SPLIT1R is not supported, it would generate
Code: |
WER274A CONTINUATION STATEMENT ERROR FOUND |
is there non blank values before SPLIT1R ?
Gerry |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
oops it should have said if SPLIT1R is not supported, it would not generate
Code: |
WER274A CONTINUATION STATEMENT ERROR FOUND |
Gerry |
|
Back to top |
|
|
nareshkareti
New User
Joined: 22 Jul 2008 Posts: 33 Location: Chennai
|
|
|
|
I am using SYNCSORT FOR Z/OS 1.3.1.0N
The string in the cntl card file looks like this
Code: |
----+----1----+----2----+--
SPLIT1R=000000000001000 |
|
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
have you checked with HEX ON to see if the first 4 bytes are blank.
Also
Code: |
OUTREC FIELDS=(C' SPLIT1R=',1,15,ZD,DIV,+10,M11,LENGTH=15) |
shows 2 spaces before SPLIT1R, yet
Code: |
----+----1----+----2----+--
SPLIT1R=000000000001000 |
shows 4 spaces.
Gerry |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Naresh,
The SYSIN control card is supposed to have an LRECL=80. Hence change your sort card in step1 to this,
Code: |
OUTREC FIELDS=(C' SPLIT1R=',1,15,ZD,DIV,+10,M11,LENGTH=15,80:X) |
|
|
Back to top |
|
|
nareshkareti
New User
Joined: 22 Jul 2008 Posts: 33 Location: Chennai
|
|
|
|
Thank u very much Arun...
I made the lrecl of the cntl file as 80 and made the values after the string as spaces and it worked...
Here is how i built the cntl card
Code: |
SORT FIELDS=COPY
OUTREC FIELDS=(C' SPLIT1R=',1,15,ZD,DIV,+10,M11,LENGTH=15,26:X) |
|
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Naresh,
You're welcome. Glad that it worked for you.
But it should have been 80:X instead of 26:X |
|
Back to top |
|
|
nareshkareti
New User
Joined: 22 Jul 2008 Posts: 33 Location: Chennai
|
|
|
|
Arun,
Could you please tell me why it should be 80:X...as the first 25 places are occupied by the string.. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Hi,
What LRECL do you expect for the outputs? |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi Naresh,
Quote: |
Could you please tell me why it should be 80:X...as the first 25 places are occupied by the string..
|
80:X - increases the record length of the output record to 80 padded with blanks.
Gerry |
|
Back to top |
|
|
sudhir1507
New User
Joined: 10 Nov 2009 Posts: 4 Location: India
|
|
|
|
use this Jcl
OPTION COPY
OUTFIL FNAMES=SORTOUT4,ENDREC=1000
OUTFIL FNAMES=SORTOUT5,STARTREC=1001,ENDREC=2000 |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Will this really give what had been asked...nearly 8 months back? |
|
Back to top |
|
|
|