Merge MT940 pages using :28C: statement and sequence numbers
The components of :28C: identify the statement number and optional page sequence. Key the merge by account, reporting cycle and sequence before testing the intermediate balance.
Open this sample in Air-Gapped ConverterWorked bank sample
Synthetic bank data for local reconciliation.
:20:REPORT-1
:25:EUR-OPERATING
:28C:00042/1
:60F:C261130EUR100,00
:61:2611301130C25,00NTRFINV-0042//BANK-841
:86:First page receipt
:62M:C261130EUR125,00
:20:REPORT-2
:25:EUR-OPERATING
:28C:00042/2
:60M:C261130EUR125,00
:61:2611301130C25,00NTRFINV-0042//BANK-841
:86:Second page receipt
:62F:C261130EUR150,00Field anatomy
| Field or path | Meaning in this file | Type or format | ERP or Excel import risk |
|---|---|---|---|
| :28C: before / | Statement number | Up to five digits | Stripping zeros breaks external file keys. |
| :28C: after / | Sequence within statement | Up to five digits | Lexical sorting puts page 10 before page 2. |
Root cause and ERP fix
- A delivery repeats page one. Compare account, statement, sequence and content before suppressing it.
- Pages arrived out of order. Sort numerically on the sequence and test the carry.
- Numbering restarted in a new cycle. Add reporting period and account to the merge key.
Inspect with the MIT parser
Save the sample as mt940-statement-sequence-merging.sta and the script as inspect.mjs. With @stmtrecon/parser installed, run node inspect.mjs mt940-statement-sequence-merging.sta.
import { readFile } from 'node:fs/promises';
import { inspect } from '@stmtrecon/parser';
const text = await readFile(process.argv[2], 'utf8');
const blocks = text.replace(/\r/g, '').replace(/^-[ \t]*$/gm, '').trim().split(/(?=^:20:)/m);
const reports = blocks.map(block => inspect(block.trim(), { transactions: true }));
const parts = reports.map(r => r.header.statementNumber.split('/'));
console.table(parts.sort((a, b) => Number(a[1]) - Number(b[1])));Open this sample in Air-Gapped ConverterExport a multi-sheet Excel workbook with balance checks and batch reconciliation on your device. No Node installation or cloud upload is required.
npm package · SDK source · Format reference