Each document will consist of the same layout. The first line of the file is the file header (FH) and it contains information regarding the contents of the file. Throughout the document, we will have numerous batch headers (BH). Information contained within the BH is only pertinent to the subsequent 0006 (detail records). There is a correlation between the BH and it's respective 0006 (detail records) The file trailer is indicated by the FT. This contains the record count. For example, I will have to take information from the BH segment and perform regular expressions based upon the content in the detail lines located immediately below the BH. Therefore, the information contained in the BH must be used for the RegExp in the subsequent detail lines. Once all of the detail lines have been read in a specific BH, the process will start over by taking the values from the next BH. The process will be completed once the entire file has been read.
Example File
| FH825693963 |
| BH0001000123 |
| 0006125 (Translate from BH0001000123) |
| 0006285 (Translate from BH0001000123) |
| 0006387 (Translate from BH0001000123) |
| 0006496 (Translate from BH0001000123) |
| 0006311 (Translate from BH0001000123) |
| 0006423 (Translate from BH0001000123) |
| BH0001000456 |
| 0006585 (Translate from BH0001000456) |
| 0006658 (Translate from BH0001000456) |
| 0006798 (Translate from BH0001000456) |
| BH0001000789 |
| 0006996 (Translate from BH0001000789) |
| 0006587 (Translate from BH0001000789) |
| FT0000000016 |
FH: File Header, BH: Batch Header, FT: File Trailer.
I truly appreciate all help that has been given to me in the past. Many thanks in advance for any and all advice.
Lastly, I would like to thank fsn, Bird, dug, anithri, Aristotle, and bronto for their help on my last question. I decided to post another thread because I felt that I did not describe my problem properly.
Thanks again!!!
In reply to Parse File Containing Multiple Batches With Correlating Detail Records by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |