Column Delimited

From Just Solve the File Format Problem
Jump to: navigation, search
File Format
Name Column Delimited

Column Delimited files are typically associated with archaic data-processing from the batch-processed punchcard era, but some data of this sort is still in use.

Unlike other data formats such as CSV which use a delimiter to separate fields, column delimited files have fixed-width fields that are defined in a field definition for the particular data set (externally to the file itself; there's usually a separate document of some sort explaining how the fields are laid out).

Each record of the database is on one line of the (text-based) file, and there usually isn't any header line (since the field names are supplied along with the column definitions). The definition will specify, for instance, that characters 0-19 of the record represent the customer's first name. This means that if the name is longer than 20 characters, it needs to be truncated to fit, and if it is shorter it is padded out by spaces. Numeric fields may have leading zeroes to pad them out to the length of their field, or may use spaces (before or after the number). Once you know the field definitions, parsing out the fields is fairly simple in any programming language that permits extraction of substrings at particular positions, though you must take care to trim out excess spaces. Exporting data into this format requires doing appropriate padding or truncation before appending the fields together into a line.


Personal tools