Splitting the file
Posted: Fri Mar 27, 2009 7:39 am
Hello
I have a requirement where i will have fixed width flat file with multiple invoices. Each invoice can be indentified by its First line's second character , which is "H" and sixth character would be " " (space) and each invoices last line's second character would be "T" and sixth character would be "M".
The input file can have any number of invoices and i need to produce multiple files such that each file should not have more than 2 invoices.
Suppose if i have 4 invoices (in the example) i need to produce 2 files with 2 invoicdes each.
also each invoice can have multiple transcations
Here is the sample data.
4H000 000 000
4H000A000 000
4L003M002 000
4L004 000 000
4L004M001 000
4L004M002 000
4T999 000 000
4T999M001 001
4T999M001 002
4H000 000 000
4H000A000 000
4L003M002 000
4L004 000 000
4L004 000 000
4L004M001 000
4L004M002 000
4T999 000 000
4T999M001 000
4H000 000 000
4H000A000 000
4L003M002 000
4L004 000 000
4L004M001 000
4L004M002 000
4T999 000 000
4T999M001 000
4H000 000 000
4H000A000 000
4L003M002 000
4L004 000 000
4L004M001 000
4L004M002 000
4T999 000 000
4T999M001 000
Appreciate your help
Thanks
I have a requirement where i will have fixed width flat file with multiple invoices. Each invoice can be indentified by its First line's second character , which is "H" and sixth character would be " " (space) and each invoices last line's second character would be "T" and sixth character would be "M".
The input file can have any number of invoices and i need to produce multiple files such that each file should not have more than 2 invoices.
Suppose if i have 4 invoices (in the example) i need to produce 2 files with 2 invoicdes each.
also each invoice can have multiple transcations
Here is the sample data.
4H000 000 000
4H000A000 000
4L003M002 000
4L004 000 000
4L004M001 000
4L004M002 000
4T999 000 000
4T999M001 001
4T999M001 002
4H000 000 000
4H000A000 000
4L003M002 000
4L004 000 000
4L004 000 000
4L004M001 000
4L004M002 000
4T999 000 000
4T999M001 000
4H000 000 000
4H000A000 000
4L003M002 000
4L004 000 000
4L004M001 000
4L004M002 000
4T999 000 000
4T999M001 000
4H000 000 000
4H000A000 000
4L003M002 000
4L004 000 000
4L004M001 000
4L004M002 000
4T999 000 000
4T999M001 000
Appreciate your help
Thanks