An ACH batch header record is a type 5 record that starts a batch for one company. A single ACH file can contain multiple batches; the entry and addenda records within each batch belong to the company identified by that batch header. In the wider fixed-width ACH layout, records are 94 characters long and fields occupy fixed positions, so parsing begins by recognizing the record type and extracting its fields. section 2.4.4 section 2.3
Treat the batch header as both a boundary and a processing decision point. Sequential processing encounters it before the batch’s type 6 entry records and type 7 addenda records. Its SEC code can select the appropriate parsing path: an IAT batch header is parsed as IAT, a PPD batch header follows the regular batch-header path, and an unrecognized type is logged as an exception. section 11.5.2 section 2.3
A practical implementation workflow is:
- Read a type 5 line and parse the batch-header fields from the required fixed-width record. section 2.4.4 section 2.3
- Use a real sample record to define the expected parsed result, rather than trusting generated test data without checking its length and fields. section 2.4.4
- Set a batch-type flag after recognizing IAT or PPD so later entry and addenda records use the matching parser. section 11.5.2
- Keep rerunning unit tests while adding IAT support to confirm PPD processing still works. section 11.5.2
Testing a type 5 record
A behavior-driven scenario supplies a batch-header line beginning with 5, parses it, and asserts that record_type_code is 5. This makes the record’s role explicit as an acceptance criterion while leaving room to add checks for other parsed fields. section 2.4.4
Listing 2.9 Parsing an ACH batch header
Feature: Parsing a Nacha Batch Header
Scenario: We have a record type of 5
When We parse the batch header
➥"5200Company name DiscretionaryData Company
IDARCComp desc 0216232302160471061000010000001"
➥ Then The record type should be 5
The scenario shows a concrete type 5 batch-header line and the simplest behavior to verify: parsing identifies its record type. section 2.4.4
