|
View previous topic :: View next topic
|
| Author |
Message |
sudarshan.srivathsav
New User
.jpg)
Joined: 10 Jul 2012 Posts: 24 Location: USA
|
|
|
|
Hi Mainframe Experts,
When I try to use the below code, I want to split a file to three parts in the same order as in the input file. Here is the example code.
| Code: |
//SORTSPL EXEC PGM=SYNCSORT,REGION=4M
//STEPLIB DD DSN=WCS.DEV.DISK.NEWSORT,DISP=SHR
//SORTIN DD DISP=(SHR,PASS),DSN=WWCSRS.SAMPLE.INPUT.FIL10
//OUT1 DD DSN=WWCSRS.SPLIT1,DISP=(NEW,CATLG),
// SPACE=(CYL,(5,5)),UNIT=SYSDA
//OUT2 DD DSN=WWCSRS.SPLIT2,DISP=(NEW,CATLG),
// SPACE=(CYL,(5,5)),UNIT=SYSDA
//OUT3 DD DSN=WWCSRS.SPLIT3,DISP=(NEW,CATLG),
// SPACE=(CYL,(5,5)),UNIT=SYSDA
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,5,CH,A)
OUTFIL FNAMES=(OUT1,OUT2,OUT3),SPLIT
|
The sort would just not maintain the order of my input file. Can someone help me to tweak this sort card to follow the Order.
Input:
AAAAA600
BBBBB200
CCCCC100
DDDDD200
EEEEE700
FFFFF600
GGGGG600
HHHHH600
IIIII600
JJJJJ600
KKKKK600
Outp1:
AAAAA600
DDDDD200
GGGGG600
JJJJJ600
Outp2:
BBBBB200
EEEEE700
HHHHH600
KKKKK600
Outp3:
CCCCC100
FFFFF600
IIIII600
No clue why it does this inspite of telling the SORT to maintain the ascending order...!! Isn't it crazy!  |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Are you aware of how SPLIT operates? Are you aware that SPLIT has some cousins, one of which may be what you want.
If your input file is already in ordear, why are you SORTing it anyway? |
|
| Back to top |
|
 |
sudarshan.srivathsav
New User
.jpg)
Joined: 10 Jul 2012 Posts: 24 Location: USA
|
|
|
|
Bill,
I need the entire data in the input file to be into three chunks after maintaining the order.
SORT FIELDS is a mandatory key word when you run the SPLIT, I also tried using SORTFIELDS=COPY, it gives me the same output.
Not sure what you mean one of them will have what you want!! I need all the three files in the same order .. |
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3112 Location: NYC,USA
|
|
|
|
Sudarshan,
| Quote: |
| No clue why it does this inspite of telling the SORT to maintain the ascending order...!! Isn't it crazy! |
No it is not. You may wants to read more on SPLIT operator.
This is how it works....
The first sorted record is written to the OUT1 data set, the second sorted record is written to the OUT2 data set, the
third sorted record is written to the OUT3 data set, the fourth sorted record is written to the OUT1 data set, and so
on in rotation.
You can find more on SPLIT on page-62
ftp.software.ibm.com/storage/dfsort/mvs/sorttrck.pdf
You may also wants to refer below link for alternate option to your requirement,
ibmmainframes.com/about45682.html |
|
| Back to top |
|
 |
sudarshan.srivathsav
New User
.jpg)
Joined: 10 Jul 2012 Posts: 24 Location: USA
|
|
|
|
| Thanks Rohit. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| sudarshan.srivathsav wrote: |
Bill,
I need the entire data in the input file to be into three chunks after maintaining the order.
SORT FIELDS is a mandatory key word when you run the SPLIT, I also tried using SORTFIELDS=COPY, it gives me the same output.
Not sure what you mean one of them will have what you want!! I need all the three files in the same order .. |
I'd be very interested to see supporting documentation for your idea that "SORT FIELDS is a mandatory key word when you run the SPLIT". Especially as you immediately contradict yourself.
Looking for SPLIT's cousins, means looking in the manual where SPLIT is documented and discovering that there is more than one type of SPLIT. SPLIT is doing what it is supposed to do, not what you want it to do.
So SPLIT is not crazy, Using a function which does something other than you want, and then complaining, I can leave you to characterise for yourself. |
|
| Back to top |
|
 |
sudarshan.srivathsav
New User
.jpg)
Joined: 10 Jul 2012 Posts: 24 Location: USA
|
|
|
|
There is just a SPLIT and SPLITBY=## , both does not serve my purpose, I would take a two step approach to do this.
But surprised IBM did not think of this !! I am sure many companies out there need to split their file without knowing the count upfront.
This feature should be a enhancement request to IBM and syncsort.
Anyways..Thanks for your helps guys! |
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
| Do you realise that Syncsort is a product of Syncsort Corporation and not of IBM? IBM's sort offering is DFSort and it has many more ways to split a file than the 2 that you ascribe to Syncsort. check out the DFSort Tricks publication in the DFSort part of the forum. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Crazy, eh? Unless you have a massively old SyncSort, I don't know what your problem with reading the documentation is.
SPLITBY1R=n
Now, since you have never made it clear, that still may no do for you. In which case you'll need to provide some code to SORT.
So. Have a look at SPLITBY1R. If that is not good for you, explain, fully, what you want to do, provide representative sample input and expected output, RECFM, LRECL. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|