IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to Split and maintain the record order


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Apr 29, 2014 1:57 am
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
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

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Tue Apr 29, 2014 3:16 am
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.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
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
Reply with quote

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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Apr 29, 2014 5:07 am
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
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: 2455
Location: Hampshire, UK

PostPosted: Tue Apr 29, 2014 2:49 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Apr 29, 2014 4:41 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top