Hi,
I have two flat files A and B both are similiar in all respect.
I need to add the records from the file A to B such that:
1. I have only one header and trailer on file B
2. A field of two character at the column 34 gets updated as shown below
3. Record count at trailer gets updated at column 35 as shown below
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
saurabhgaikwad,
You need to increment the counter in file 2 with the last value from file 1 at position 34? Is it just 2 bytes of zd number? What happens if the counter exceeds 99?
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
saurabhgaikwad wrote:
yes i need to increment the counter in file 2 with the last value from file 1 at position 34.
in the original file this is of 10 bytes so size will not be a problem.
You want a solution with 2 bytes where as in reality it is a 10 byte field? What about the format? Does the 2 vs 10 bytes hold good for the trailer records also? Please provide detailed information on what you're trying to accomplish. Do not make people guess what you mean. This will give you a much better chance of getting a good answer to your question.
Yes, 2 vs 10 bytes hold good for the trailer records also. I should not have put it as 2 bytes. Rest of the information is same.
Details:
Both files have same header and trailer. Each Detail record in both the file have SA at the 30th column (start of record) and SZ at the 30th column (end of record). So all the records between SA segment and SZ segment makes one complete record
Field at the 34th column which is of 10 bytes keeps the count of the SA/SZ segments. This field should be incremented each time another SA is encountered that is whenever we get new record.
Value of this field at the 34th column for the last record should be the value of counter in the trailer record at the 35th column.
When I add the records from the File A to B ( both files were shown above ) , I get the below result