View previous topic :: View next topic
|
Author |
Message |
Deeptha Echampati
New User
Joined: 09 Apr 2013 Posts: 2 Location: India
|
|
|
|
Hi :
I basically need to merge 2 or MORE (I dont know how many) based on a key, the "key" is the data from position 6 to 9. . My i/p file looks like this :
I would not know how my input data will look past the 11th column. All I know is it can have data (5*522 bytes = 2610 bytes) in it.
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
0010 A000 A01& A123 AB373 A7398 A3473
0011 A000 A34& A234 AB373 A7399 A3476
0012 A000 A35& A123 AB473 A7368 A3473
0010 A001 A36& A123 AB373 A7398 A3473
0013 A002 A57& A123 AB373 A7398 A3473
O/p needs to look like :
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
A000 A01& A123 AB373 A7398 A3473 A34& A234 A7399 A3476 A35& AB473 A7368 0010 0011 0012
A001 A36& A123 AB373 A7398 A3473 0010
A002 A57& A123 AB373 A7398 A3473 0013
My shop does not support ICETOOL, can we do this using DFSORT ? The O/P needs to be merged after discarding the duplicates on the data that lies beyond the 11th column. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
As you state both DFSORT and SYNCSORT, perhaps you could inform us of exactly which product and release level you have installed before anyone spends too much time on a wrong solution.
Also you will need to explain your problem much more clearly. |
|
Back to top |
|
|
Deeptha Echampati
New User
Joined: 09 Apr 2013 Posts: 2 Location: India
|
|
|
|
We use SYNCSORT Rel 1.4
To put it in a simpler this is how the files must look :
Input file : (Data in position-1 to position 11) will be of fixed length. From position 13 onwards there can be 2610 bytes of data (5 bytes of 522 items). Each of these 522 bytes might not strictly be 5 bytes in length , though the data length is PIC X(5). It can have data like A34& (4 bytes).
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
0010 A000 A01& A123 AB373
0011 A000 A34& A123
0010 A100 A567
0012 A200 A987
0013 A200 A987
Reformat file -1 : We need to split the records keeping the 1st 11 bytes constant. So basically we need to parse the data from the 13th position onwards, and split the record for every 5 byte entry present in the data beyond the 13th position.
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
0010 A000 A01&
0010 A000 A123
0010 A000 AB373
0011 A000 A34&
0011 A000 A123
0010 A100 A567
0012 A200 A987
0013 A200 A987
Final output file : This should merge back the records and produce this : The key will still be data from the 7th col to 11th col. Duplicates must be eliminated and the 1st field for every key must be appended at the end of the record.
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
0010 A000 A01& A123 AB373A34& 0010 0011
0010 A100 A567 0010
0012 A200 A987 0012 0013
I am unsure about the procedure adopted here. Pls let me know if there is a better method of doing this. |
|
Back to top |
|
|
|