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

Split file into 5 files with equal records


IBM Mainframe Forums -> CA Products
Post new topic   Reply to topic
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
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

Moderator Emeritus


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

PostPosted: Thu Oct 22, 2009 9:22 pm
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Oct 23, 2009 11:23 am
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Oct 23, 2009 2:16 pm
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

Moderator Emeritus


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

PostPosted: Fri Oct 23, 2009 7:43 pm
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
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

Moderator Emeritus


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

PostPosted: Sun Oct 25, 2009 2:05 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CA Products

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
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
Search our Forums:

Back to Top