Split multi-account MT940 files at account and message boundaries
A new statement identifies its account in :25:. Flat exports can separate statements with a hyphen line and FIN envelopes can close with -}. Reset the statement context before assigning the next movement.
Open this sample in Air-Gapped ConverterWorked bank sample
Synthetic bank data for local reconciliation.
:20:REPORT-1
:25:OPERATING
:28C:007/1
:60F:C261130EUR100,00
:61:2611301130C25,00NTRFINV-0042//BANK-841
:86:Operating account receipt
:62F:C261130EUR125,00
-
:20:REPORT-2
:25:RESERVE
:28C:008/1
:60F:C261130EUR300,00
:61:2611301130C25,00NTRFINV-0042//BANK-841
:86:Reserve account receipt
:62F:C261130EUR325,00Field anatomy
| Field or path | Meaning in this file | Type or format | ERP or Excel import risk |
|---|---|---|---|
| :25: | Reporting account identifier | Account string | Matching only on :28C: merges separate accounts. |
| - / -} | Flat separator / FIN text terminator | Profile-specific delimiter | A hyphen attached to :62F: breaks the balance. |
Root cause and ERP fix
- Account context leaked across a boundary. Read the next :25: before assigning movements.
- A hyphen in a reference was treated as a separator. Recognise only a complete delimiter line.
- A total balanced across two accounts. Test each account and currency separately.
Inspect with the MIT parser
Save the sample as mt940-account-switch-delimiters.sta and the script as inspect.mjs. With @stmtrecon/parser installed, run node inspect.mjs mt940-account-switch-delimiters.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 accounts = blocks.map(block => block.match(/^:25:(.+)$/m)[1]);
console.table(reports.map((r, i) => [accounts[i], r.opening, r.closing]));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