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
 

 

SPLIT FILE into multiple files using Syncsort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: SPLIT FILE into multiple files using Syncsort
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: 2422
Location: Netherlands, Amstelveen

PostPosted: Thu Dec 10, 2009 8:34 pm    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Thu Dec 10, 2009 8:42 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Dec 10, 2009 8:45 pm    Post subject: Reply to: SPLIT FILE into multiple files using Syncsort
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: 500
Location: USA

PostPosted: Thu Dec 10, 2009 10:00 pm    Post subject:
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: 2422
Location: Netherlands, Amstelveen

PostPosted: Thu Dec 10, 2009 10:58 pm    Post subject: Re: Reply to: SPLIT FILE into multiple files using Syncsort
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Dec 10, 2009 11:13 pm    Post subject: Reply to: SPLIT FILE into multiple files using Syncsort
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

Site Director


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

PostPosted: Fri Dec 11, 2009 1:08 am    Post subject:
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    Post subject: Reply to: SPLIT FILE into multiple files using Syncsort
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

Site Director


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

PostPosted: Fri Dec 11, 2009 8:23 pm    Post subject:
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    Post subject: Reply to: SPLIT FILE into multiple files using Syncsort
Reply with quote

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

Site Director


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

PostPosted: Sun Dec 13, 2009 2:52 am    Post subject: Reply to: SPLIT FILE into multiple files using Syncsort
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    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 syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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