|go ahead... be a heretic|
Re: Reading File and Seperating into columnsby boftx (Deacon)
|on Sep 25, 2013 at 22:58 UTC||Need Help??|
For starters, I noticed that 99HEADER appears twice in the data before 99TERMIN does (the second time is 13 lines before the 99TERMIN.)
This is one of the strangest data files I have seen, but that aside, I suspect there might be a problem lurking in the wings by simply treating every delimited record as having the same data structure when clearly they don't. It seems to me that the first field is a record type code and each type has its own definition that should be honored. This is quite common in data transfer files, and I think it would be obvious if this was in XML instead of a bastardized fixed-length record structure. (leave it to the insurance industry to screw this up.)
Thankfully you apparently don't need to break apart the data before the 99HEADER, but those records you are concerned with are in fact easy to work with as pipe (|) delimited and I wouldn't bother converting to CSV for all the reasons given above.
What I would be concerned with are those type codes in the first field, especially since there are repeating field types, including the 99HEADER type.
If I had to guess it looks like you are dealing with a single account record that has coverage information on multiple vehicles (with 99HEADER indicating the start of a new vehicle.)
On a side note, Perl is ideal for processing this kind of data if you have the full API spec for the data file handy.
On time, cheap, compliant with final specs. Pick two.