View previous topic :: View next topic |
Author |
Message |
20cents Beginner

Joined: 26 Oct 2005 Posts: 25 Topics: 7 Location: Between Heaven and Hell
|
Posted: Thu Jul 20, 2006 1:50 am Post subject: Split File but Like records should be copied together |
|
|
I need to split a file into 3 files (equal as much as possible) but all same accounts (cols 1 to 9) must reside in one file.
Any way to split it in three files?
Such that:
Code: |
123456789A0F4POL1234554321 44 RB
123456789BF4POL1234554321 46 09
123456789CF4POL1234554321 47 05
111111111AF4POL1212121212 43 RR
111111111BF4POL1212121212 46 09
222222222AF4POL2323232333 43 RR
222222222BF4POL2323232333 43 RR
222222222CF4POL2323232333 43 RR
222222222DF4POL2323232333 43 RR
222222222EF4POL2323232333 43 RR
333333333AF4POL3434343434 43 RR
333333333BF4POL3434343434 43 RR
333333333CF4POL3434343434 43 RR
333333333DF4POL3434343434 43 RR
|
Output File 1
Code: |
123456789A0F4POL1234554321 44 RB
123456789BF4POL1234554321 46 09
123456789CF4POL1234554321 47 05
111111111AF4POL1212121212 43 RR
111111111BF4POL1212121212 46 09
|
Output file 2
Code: |
222222222AF4POL2323232333 43 RR
222222222BF4POL2323232333 43 RR
222222222CF4POL2323232333 43 RR
222222222DF4POL2323232333 43 RR
222222222EF4POL2323232333 43 RR
|
Ouput file 3
Code: |
333333333AF4POL3434343434 43 RR
333333333BF4POL3434343434 43 RR
333333333CF4POL3434343434 43 RR
333333333DF4POL3434343434 43 RR
|
|
|
Back to top |
|
 |
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Thu Jul 20, 2006 2:34 am Post subject: |
|
|
20cents,
Do u want to have first 5 records only for the File 1 and next 5 records to File 2 and the remaining records to File 3 assuming that your input has 14 records only ? _________________ Shekar
Grow Technically |
|
Back to top |
|
 |
20cents Beginner

Joined: 26 Oct 2005 Posts: 25 Topics: 7 Location: Between Heaven and Hell
|
Posted: Thu Jul 20, 2006 2:59 am Post subject: |
|
|
shekar123,
First, thanks for the prompt reply.
Yes. but do take note that records with the same account number (cols 1 to 10) must reside on the same file.
111111111A
111111111B
111111111C
111111111D
222222222A
222222222B
222222222C
333333333A
333333333B
333333333C
333333333D
444444444A
444444444B
444444444C
444444444D
555555555A
666666666A
666666666B
777777777A
FILE 1:
111111111A
111111111B
111111111C
111111111D
222222222A
222222222B
222222222C
FILE 2:
333333333A
333333333B
333333333C
333333333D
444444444A
444444444B
444444444C
444444444D
FILE 3:
555555555A
666666666A
666666666B
777777777A
As cited on the above example, there are 19 rows to be divided into three, hopefully with 6 recs on file1, 6 recs on file2, and 7 recs on file3 -
but the 7th record having "222222222C" account number should also go the file1.
and the 13th and 14th record having "333333333B/C" account number should also go to file2.
Simply put, I want to divide a file of accounts into three parts but grouping all accounts with the same first 9-bytes. |
|
Back to top |
|
 |
20cents Beginner

Joined: 26 Oct 2005 Posts: 25 Topics: 7 Location: Between Heaven and Hell
|
Posted: Thu Jul 20, 2006 8:00 pm Post subject: |
|
|
/prays before the SORT-gods... answer my prayer please.  |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Thu Jul 20, 2006 9:20 pm Post subject: |
|
|
20cents,
It is little trickier to get what you are asking. Is easytrieve an option?
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
20cents Beginner

Joined: 26 Oct 2005 Posts: 25 Topics: 7 Location: Between Heaven and Hell
|
Posted: Thu Jul 20, 2006 10:21 pm Post subject: |
|
|
kolusu wrote: | 20cents,
It is little trickier to get what you are asking. Is easytrieve an option?
Kolusu |
We are currently using easytrieve to split the file. But, the performance team advised to change it to syncsort, they claimed its cheaper and has better performance. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Fri Jul 21, 2006 7:45 am Post subject: |
|
|
Quote: |
But, the performance team advised to change it to syncsort, they claimed its cheaper and has better performance.
|
Well a simple Split can be advantageous but , in your case a pgm is a better option. What are the DCB properties of the file? Is your input file already sorted on the key ?
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
|
|