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

SPLIT FILE into multiple files using Syncsort


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sonali12_9

New User


Joined: 13 Feb 2009
Posts: 20
Location: United States of america

PostPosted: Thu Dec 10, 2009 8:11 pm
Reply with quote

I want to split file into 4 different files as input file is very huge and cannot be ftped. Number of records in input file is not fixed and number of output files is fixed i.e 4

Input
AAS
AVG
FSDF
DGG
SFF
SDGDG
GFG
AGH

i tried by
SORT FIELDS=COPY
OUTFIL FNAMES=(OUT1,OUT2,OUT3,OUT4),SPLIT
In o/p m getting
first file
AAS
SFF

2ND FILE
AVG
SDGDG

3RD FILE
FDSF
GFG
4th file
DGG
AGH

BUT i want o/p like

1st file
AAS
AVG
2nd file
FSDF
DGG
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Dec 10, 2009 8:34 pm
Reply with quote

Im not quite a SORT fan, too difficult control cards.
For this kind of things i always used SAS or Easytrev,
or wrote some assembler stuff.

So if you have SAS or Easytrev installed use that.

I guess im getting a lifelong ban now. icon_rolleyes.gif
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Dec 10, 2009 8:42 pm
Reply with quote

Peter,

I'll beg to differ with you on this one,

The sort products these days are far more efficient at handling large numbers of records than most other products. The products have come a long long way in a short time and can be really useful for lots of things.

Quote:
I guess im getting a lifelong ban now.

Only if Frank or Allissa see your post icon_biggrin.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Dec 10, 2009 8:45 pm
Reply with quote

the main issue with splitting is a performance one...

alternate splitting is the fastest, it needs just one pass over the input file

sequential splitting on the other side requires two passes, the first to get the count, the second one to do the splitting
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Thu Dec 10, 2009 10:00 pm
Reply with quote

If all 4 files do not have to have the same number of records, then you can code something similar to the following:
Code:
//SYSIN DD *                           
   SORT FIELDS=COPY                     
   OUTFIL FILES=01,ENDREC=10000             
   OUTFIL FILES=02,STARTREC=10001,ENDREC=20000 
   OUTFIL FILES=03,STARTREC=20001,ENDREC=30000 
   OUTFIL FILES=04,SAVE                 
/*                 
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Dec 10, 2009 10:58 pm
Reply with quote

enrico-sorichetti wrote:
the main issue with splitting is a performance one...

alternate splitting is the fastest, it needs just one pass over the input file

sequential splitting on the other side requires two passes, the first to get the count, the second one to do the splitting


Im not sure if i understand this "alternate splitting", please enlighten me.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Dec 10, 2009 11:13 pm
Reply with quote

Hi Peter,
I just made up the terminology

given a dataset with 10 records
0,1,2,3,4,5,6,7,8,9

by alternating I meant
1st file 0,2,4,6,8
2nd file 1,3,5,7,9
just as You read a record write to the next file of the split

by sequential
1st file 01234
2nd file 56789

that' s all !
I was tempted to use the term oscillating (like in sort, using tapes as workfiles )
but I thought it would have been less clear
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Dec 11, 2009 1:08 am
Reply with quote

Hello,

What creates the large file?

If you have control of that process, modify it to generate a record count. Use the generated record count to determine the "split" values for the sort control statements.
Back to top
View user's profile Send private message
sonali12_9

New User


Joined: 13 Feb 2009
Posts: 20
Location: United States of america

PostPosted: Fri Dec 11, 2009 11:30 am
Reply with quote

Thanks to everyone for your interest in helping me.

Retrieving records from DB2 table is creating a large file.
ACtually, my requirement is to convert code in focus to COBOL since focus is taking long time for execution. So i need to match the output of focus and cobol.

I am looking for some option to split file sequentially as doing it in cobol will be inefficient and increase select statements in program.

Hi enrico,
As you said -"sequential splitting on the other side requires two passes, the first to get the count, the second one to do the splitting "

is there any way to implement this logic if i have total number of records in one file??
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Dec 11, 2009 8:23 pm
Reply with quote

Hello,

Yes.

Divide the total number of records by 4 and generate the appropriate sort control statements (like ALissa posted above). Instead of a SYSIN DD * you would use a SYSIN DD DSN=. . .
Back to top
View user's profile Send private message
sonali12_9

New User


Joined: 13 Feb 2009
Posts: 20
Location: United States of america

PostPosted: Sat Dec 12, 2009 12:25 pm
Reply with quote

Thanks. It worked now
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Dec 13, 2009 2:52 am
Reply with quote

Good to hear it is working - thanks for letting us know icon_smile.gif

d
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 Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top