Handle Multi-Record-Type Fixed-Width Files

Process fixed-width files containing multiple record types with different layouts. Learn strategies for identifying and separating record types.

Data Processing

Detailed Explanation

Multi-Record-Type Files

Many fixed-width files contain different types of records in a single file, each with a different layout. A common pattern is Header / Detail / Trailer (HDT):

Example File

H20240115BATCH001Company Inc
D001ALICE SMITH        000012345620240110
D002BOB JONES          000098765620240112
D003CHARLIE BROWN      000000150020240114
T003000111261220240115

Record Structures

Header (H):

Field Pos Width
RecType 0 1
BatchDate 1 8
BatchID 9 8
CompanyName 17 24

Detail (D):

Field Pos Width
RecType 0 1
SeqNo 1 3
Name 4 20
Amount 24 10
Date 34 8

Trailer (T):

Field Pos Width
RecType 0 1
RecCount 1 3
TotalAmount 4 10
Date 14 8

Processing Strategy

Since this tool uses a single column definition at a time, process multi-record files in stages:

  1. Identify the record type field (usually the first 1-2 characters)
  2. Filter lines by type — manually or with a text editor
  3. Convert each type separately with its own column definition
  4. Combine the results if needed

Tips

  • The record type indicator is almost always at the very beginning of each line
  • Use presets to quickly switch between different column layouts
  • Save your column definitions for each record type for reuse

Use Case

Processing batch files from financial clearing houses, insurance claim files with header/detail/trailer records, or government data submissions with mixed record layouts.

Try It — Fixed Width ↔ CSV Converter

Open full tool