In this recipe, we will parse a fixed-width file by creating a simple streaming parser. Our sample file will contain fixed-width columns of strings, numbers, dates, and Boolean values of accounting data. Our goal is to count the records and get a total credit and debit amount for all records that have been posted.
Our sample file looks like the following:
In this section, we will create our own parser for fixed-width files. When considering the features we would like for our basic parser, it should: