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 5 files with equal records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CA Products
View previous topic :: :: View next topic  
Author Message
rahul_jot

New User


Joined: 17 Aug 2005
Posts: 22
Location: Pune

PostPosted: Thu Oct 22, 2009 6:47 pm    Post subject: Split file into 5 files with equal records
Reply with quote

Hi,

I have FB file to which is updated on daily basis with around 1 Million records. The total number of records get changed on daily basis. I have requirement to split the files into 5 files with equal number of records in each. (If the total records are not divisible by 5, last file can contain a few records less). My client does not want to use SORT/ICETOOL. Can this be achieved through EZT?
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: Thu Oct 22, 2009 9:22 pm    Post subject:
Reply with quote

Hello,

Yes. All you have to do is define the input file and the 5 output files, read the input, and selectively write to the appropriate output file.
Back to top
View user's profile Send private message
rahul_jot

New User


Joined: 17 Aug 2005
Posts: 22
Location: Pune

PostPosted: Fri Oct 23, 2009 10:11 am    Post subject: Reply to: Split file into 5 files with equal records
Reply with quote

Thanks for your inputs!

If I have 100 rec in the input, I want to have first 20 in 1st file, next 20 in 2nd and so on. If I selectively write the recs into output, the data will not be in required order.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10232
Location: italy

PostPosted: Fri Oct 23, 2009 11:23 am    Post subject: Reply to: Split file into 5 files with equal records
Reply with quote

Quote:
If I selectively write the recs into output, the data will not be in required order
.

please clarify ...
what is the records order in the input file
what is the record order required

if the input is in the proper order, no reason for a simple copy to give a wrong one ...

as usual the unwillingness to use the best tool for the task implies sheer stupidity on the client's side icon_wink.gif
Back to top
View user's profile Send private message
rahul_jot

New User


Joined: 17 Aug 2005
Posts: 22
Location: Pune

PostPosted: Fri Oct 23, 2009 2:08 pm    Post subject: Reply to: Split file into 5 files with equal records
Reply with quote

Suppose my records are:
AAAAAAAAA
BBBBBBBBB
CCCCCCCC
DDDDDDD
EEEEEEEEEE
FFFFFFFFFFF
GGGGGGG
HHHHHHHH
IIIIIIIIIIII

I need output as:
File 1:
AAAAAAAAA
BBBBBBBBB
File 2
CCCCCCCC
DDDDDDD
File 3
EEEEEEEEEE
FFFFFFFFFFF
File 4
GGGGGGG
HHHHHHHH
File 5
IIIIIIIIIIII
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10232
Location: italy

PostPosted: Fri Oct 23, 2009 2:16 pm    Post subject: Reply to: Split file into 5 files with equal records
Reply with quote

the data You posted adds nothing to the issue
I asked why You feel that
"If I selectively write the recs into output, the data will not be in required order"
icon_question.gif
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 Oct 23, 2009 7:43 pm    Post subject:
Reply with quote

Hello,

To get what you want, count the total number records first and then write the appropriate number of records to each output file (rather than writing 1 record to each output in rotation).
Back to top
View user's profile Send private message
rahul_jot

New User


Joined: 17 Aug 2005
Posts: 22
Location: Pune

PostPosted: Sat Oct 24, 2009 9:50 am    Post subject: Reply to: Split file into 5 files with equal records
Reply with quote

Thanks Dick! I am following same approach through cobol. But it requires me opening and closing of the file twice. I wanted to avoid that. So I was just thinking if there is any other way of doing it.

Enrico,
If I selectively write the recs into the output i.e. 1st rec will go to 1st file, 2nd to 2nd, ... 5th to 5th, 6th to 1st file and so on. So with the sample input I provided, my output will look like
File1
AAAAAAAAA
FFFFFFFFFFF
File2
BBBBBBBBB
GGGGGGG
File3
CCCCCCCC
HHHHHHHH
File4
DDDDDDD
IIIIIIIIIIII
File5
EEEEEEEEEE

But this is not the output I require. The actual output I am looking for is:
File 1:
AAAAAAAAA
BBBBBBBBB
File 2
CCCCCCCC
DDDDDDD
File 3
EEEEEEEEEE
FFFFFFFFFFF
File 4
GGGGGGG
HHHHHHHH
File 5
IIIIIIIIIIII

This is the reason I was saying data will not be in required order. Hope this helps!
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 Oct 25, 2009 2:05 am    Post subject:
Reply with quote

Hello,

Quote:
So I was just thinking if there is any other way of doing it.
Have the process that creates the file modified so that a "header" record is created with the total record count in it.

If you explain why there is a need to split the input this way someone may have a suggestion on how to meet the need.
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 -> CA Products All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts splitting of file using XMITIP abdulrafi TSO/ISPF 3 Mon Mar 27, 2017 3:01 pm
No new posts Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm


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