Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to Split and maintain the record order

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
sudarshan.srivathsav

New User


Joined: 10 Jul 2012
Posts: 24
Location: USA

PostPosted: Tue Apr 29, 2014 1:44 am    Post subject: How to Split and maintain the record order
Reply with quote

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! icon_eek.gif icon_eek.gif
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Tue Apr 29, 2014 1:57 am    Post subject: Reply to: How to Split and maintain the record order
Reply with quote

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
View user's profile Send private message
sudarshan.srivathsav

New User


Joined: 10 Jul 2012
Posts: 24
Location: USA

PostPosted: Tue Apr 29, 2014 2:07 am    Post subject: How to Split and maintain the record order
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Tue Apr 29, 2014 3:16 am    Post subject:
Reply with quote

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://ftp.software.ibm.com/storage/dfsort/mvs/sorttrck.pdf

You may also wants to refer below link for alternate option to your requirement,

https://ibmmainframes.com/about45682.html
Back to top
View user's profile Send private message
sudarshan.srivathsav

New User


Joined: 10 Jul 2012
Posts: 24
Location: USA

PostPosted: Tue Apr 29, 2014 4:49 am    Post subject:
Reply with quote

Thanks Rohit.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Tue Apr 29, 2014 5:07 am    Post subject: Re: How to Split and maintain the record order
Reply with quote

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
View user's profile Send private message
sudarshan.srivathsav

New User


Joined: 10 Jul 2012
Posts: 24
Location: USA

PostPosted: Tue Apr 29, 2014 5:38 am    Post subject:
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1715
Location: UK

PostPosted: Tue Apr 29, 2014 2:49 pm    Post subject: Reply to: How to Split and maintain the record order
Reply with quote

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
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Tue Apr 29, 2014 4:41 pm    Post subject: Reply to: How to Split and maintain the record order
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts how to split records based on specifi... Venkata Ramayya DFSORT/ICETOOL 6 Wed Sep 28, 2016 3:20 am
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us