Filling in records instead of spaces!!!
Posted: Wed Jul 25, 2012 11:45 pm
Hi Everyone,
My requirement goes this way. I would like to fill in the spaces with the records present with in a file. Below mentioned is an example of the same.
Input file:-
The first 8 positions are of key fields. If there were spaces in the first 8 positions then we need to compare the key fields of before and next lines where the space exists and if they are same then we need to replace those spaces with the key fields. In the above input file the keyfields which were present above and below the spaces (which mean whose first 8 positions are spaces) are of same and the spaces should be replaced by the key field as shown in the below output file.
Output file:-
Can someone please provide me the sort card in achieving the same.
Thanks in advance!!!
My requirement goes this way. I would like to fill in the spaces with the records present with in a file. Below mentioned is an example of the same.
Input file:-
00001234 ERROR1 TYPE OF ERROR
00001234 ERROR ABOUT
00001234 TYPE2
ERROR FIELD
00001234 ERROR DESCRIPTION
00001234 DESC ENDED
00004567 ERROR2 TYPE OF ERROR
00004567 ERROR NAME
TYPE3
00004567 DESC ENDED
00001234 ERROR ABOUT
00001234 TYPE2
ERROR FIELD
00001234 ERROR DESCRIPTION
00001234 DESC ENDED
00004567 ERROR2 TYPE OF ERROR
00004567 ERROR NAME
TYPE3
00004567 DESC ENDED
The first 8 positions are of key fields. If there were spaces in the first 8 positions then we need to compare the key fields of before and next lines where the space exists and if they are same then we need to replace those spaces with the key fields. In the above input file the keyfields which were present above and below the spaces (which mean whose first 8 positions are spaces) are of same and the spaces should be replaced by the key field as shown in the below output file.
Output file:-
00001234 ERROR1 TYPE OF ERROR
00001234 ERROR ABOUT
00001234 TYPE2
00001234 ERROR FIELD
00001234 ERROR DESCRIPTION
00001234 DESC ENDED
00004567 ERROR2 TYPE OF ERROR
00004567 ERROR NAME
00004567 TYPE3
00004567 DESC ENDED
00001234 ERROR ABOUT
00001234 TYPE2
00001234 ERROR FIELD
00001234 ERROR DESCRIPTION
00001234 DESC ENDED
00004567 ERROR2 TYPE OF ERROR
00004567 ERROR NAME
00004567 TYPE3
00004567 DESC ENDED
Can someone please provide me the sort card in achieving the same.
Thanks in advance!!!