Re: variable size record length file parsing
- From: "Matt Williamson" <ih8spam@xxxxxxxxxxx>
- Date: Mon, 14 May 2007 17:08:02 -0400
I need help parsing a file that will have variable sized record lengths.
It depends on the format of the file and how the records are separated.
Each line is between 280-320 chars long and ends with an "X" then a
CR/LF. Here is an example of a few lines from the file:
You pretty much only have two options: using Line Input and working with a
line at a time or reading the file into a byte array (completely or in
chunks) and searching for CRLF yourself, which is pretty much what Line
Input is doing.
Users love delimited, non-fixed-width files because they're easy to work
with for them. As a programmer, I despise them. Fixed-width files rock.
I guess a third option would be to open the file in line input mode and dump
all of the recordsizes into an array and close the file, then re-open it in
binary and use those for my record sizes. I really like using the UDT with
fixed string sizes because I have a document that tells me exactly what they
are. So it's much easier to do it that way and it's fast too.
If anyone else wants to chime it, I'm listening.
Matt
.
- Follow-Ups:
- Re: variable size record length file parsing
- From: Larry Serflaten
- Re: variable size record length file parsing
- From: Rick Rothstein \(MVP - VB\)
- Re: variable size record length file parsing
- References:
- variable size record length file parsing
- From: Matt Williamson
- Re: variable size record length file parsing
- From: Mike Williams
- Re: variable size record length file parsing
- From: Matt Williamson
- Re: variable size record length file parsing
- From: Jeff Johnson
- variable size record length file parsing
- Prev by Date: Re: Exiting from a Do Loop
- Next by Date: Re: Checking for Files on a Network Drive
- Previous by thread: Re: variable size record length file parsing
- Next by thread: Re: variable size record length file parsing
- Index(es):