View previous topic :: View next topic
|
Author |
Message |
rahul_jot
New User
Joined: 17 Aug 2005 Posts: 22 Location: Pune
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
rahul_jot
New User
Joined: 17 Aug 2005 Posts: 22 Location: Pune
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
Back to top |
|
|
rahul_jot
New User
Joined: 17 Aug 2005 Posts: 22 Location: Pune
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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"
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
rahul_jot
New User
Joined: 17 Aug 2005 Posts: 22 Location: Pune
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|