senthamizh
New User
Joined: 27 Apr 2009 Posts: 23 Location: mumbai
|
|
|
|
Hi,
I have a input file in below format
Code: |
DTL001111111 1234567890123-0000001R01/10/20181234567890xxxxx 123
DTL001111111 2345678901234-0000003R01/10/20181234567890xxxxx 123
DTL001111111 3456789012345-0000004R01/10/20181234567890xxxxx 123
DTL002222222 1234567890123-0000001R01/10/20181234567890xxxxx 124
DTL002222222 2345678901234-0000003R01/10/20181234567890xxxxx 124
DTL002222222 3456789012345-0000004R01/10/20181234567890xxxxx 123 |
the records should be grouped based on position 61,3 (123 or 124) and position 1,12(DTL0011111111 or DTL00222222222) then Header should be added to group.Header formate is as below
HDR1230011111111 P111111 000 1
the output should be as below
Code: |
HDR123001111111 P111111 000 1
DTL001111111 1234567890123-0000001R01/10/20181234567890xxxxx 123
DTL001111111 2345678901234-0000003R01/10/20181234567890xxxxx 123
DTL001111111 3456789012345-0000004R01/10/20181234567890xxxxx 123
HDR123002222222 P111111 000 1
DTL002222222 3456789012345-0000004R01/10/20181234567890xxxxx 123
HDR124002222222 P111111 000 1
DTL002222222 1234567890123-0000001R01/10/20181234567890xxxxx 124
DTL002222222 2345678901234-0000003R01/10/20181234567890xxxxx 124
TRL |
Input record length is 65
output record length is 65.
Please lets me know if it can be done by SORT?
If it can be done in sort pls give idea to write sort condition for this requirement.
Thanks,
Sen |
|