BAI2 — one American account, reported back the next morning
Ten lines of a , and the first thing to do with them is read the first two characters of every line, because until they are read nothing else on the line has a meaning. 01 opens the file, 02 opens a group, 03 opens an account, 16 is one transaction, 88 continues the line above it, and 49, 98 and 99 close the account, the group and the file.
Start with the group, because it holds two facts every line below it depends on and none of them repeats. Field 7 reads USD, so that is the currency of every amount in the group. Field 5 reads 260811, so that is the date the data covers — which is not 260812 in the file header above, the date the file was made. Field 8 reads 2, meaning final previous-day data: this is the whole of the eleventh and not a slice of it, which is what makes a missing entry a finding rather than a maybe.
Then the account. Its balances sit in fours — a type code, an amount, an item count and a funds type. There are three of them: 010 the opening ledger at 25000000, 015 the closing ledger at 28100000, and 045 the closing available at 27500000. Two digits after the point are implied and never written, so those are 250,000.00, 281,000.00 and 275,000.00 dollars. The 6,000.00 between the last two is the cheque deposited on the second transaction line, booked to the ledger and not yet available to spend.
Now the three transactions, and watch where the references sit. On the first, field 4 reads 0 — available immediately — so nothing is inserted and the bank reference is the very next field. On the second, field 4 reads 1, one-day availability, and the same is true. Under S, V or D it would not be: those three insert further fields, and the bank reference would move along the line. The last transaction is continued on an 88, whose text belongs to the line above it rather than to itself.
Last, the three trailers. 49 says the account's amounts sum to 85700000 across six lines, 98 says the group's one account sums to the same across eight, and 99 says the file's one group sums to the same across ten. The totals are unsigned sums of every amount field, balances included, so they catch a dropped line that a net figure would hide.
SYNTHETIC / TRAINING ONLY. Nothing here is a real file and no line was copied from one. The ten lines were built field by field at the field positions the record page declares, then parsed by one of the two open implementations behind that page. That implementation validated the record codes, the field order, the funds-type branches, the continuation merge and all three levels of control total against them. Asha Traders, Demo Trading Ltd and Example Supplies Ltd are this site's registered fictional companies and Northstar Bank is its fictional commercial bank; none names a real business. The sender and receiver identifiers are written as names rather than as numbers on purpose. Nothing read for this page says what kind of identifier belongs in those fields, and writing digits there would have implied a routing number this site cannot show is unassigned. The account number 9900000012345 is invented. The United States publishes no check-digit rule for a bank account number. Unlike the Swedish and Polish samples on this site this identifier cannot be built to fail an arithmetic test, and it is written as a width to count fields against. The three balance type codes and the three transaction type codes are real published values, taken from the transcription of the code list the record page cites and marks as a single transcription rather than three readings. Not validated against the BAI specification, which could not be opened, nor against any American bank or treasury system.
Sources for this sample — 4 sources
- Market practice
ministryofjustice/bai2 — a Python parser and writer for the BAI2 format ↗ — Ministry of Justice, United Kingdom (open source, MIT) · bai2/parsers.py and bai2/constants.py — the field order of every record placed in these ten lines, the funds-type values 0 and 1 and the fact that neither inserts a further field, the 88 continuation merge, and the control-total and record-count validations that were run against this sample and passed
An implementation and not the publisher, and the reason this site can describe the layout at all: the specification is unreachable from here and this is a transcription of it that is not. Read at raw.githubusercontent.com on the access date at the master branch: bai2/constants.py, bai2/models.py, bai2/parsers.py, bai2/helpers.py, bai2/utils.py and README.rst.
Two of its own statements are carried on this site as claims about the format's dialects rather than about the library. It says in as many words that different banks implement the specification in slightly different ways, and that it is known to work with files from three named banks. Its helper for the account identifier record normalises an extra comma that it records as emitted by some banks and not others, which is a dialect difference visible in code.
Its type-code table is NOT independent of the Ruby implementation cited beside it — the descriptions agree character for character across 469 codes, including the en dashes, so the two are copies of one transcription rather than two readings. This site therefore cites the type-code list at that strength and publishes no exhaustive code table.
- Market practice
venturehacks/bai2 — a Ruby gem that parses BAI2 files received from banks ↗ — Venture Hacks (open source, MIT) · lib/bai2/record.rb — the independent second declaration of the same field order, written in another language by another author, which is what lets these positions be published rather than merely used
An implementation and not the publisher. Read at raw.githubusercontent.com on the access date at the master branch: lib/bai2/record.rb, lib/bai2/parser.rb, lib/bai2/type-code-data.rb and README.md.
Its source comments name the BAI specification as the origin of its rules, and print a URL for it on bai.org. That is one of the two independent attestations of that document's title and publisher recorded in the specification's own entry.
It refuses any file whose version number is not 2, exactly as the Python implementation does, which is why this site states the version field as a guard rather than as decoration. Its type-code table is a copy of the same transcription the Python implementation carries and is not independent of it — see that entry.
- Market practice
mrrozz/bai2-codes-csv — the BAI2 type-code list as a CSV ↗ — mrrozz (open source) · bai-codes.csv — the six type codes written into these lines: 010 opening ledger, 015 closing ledger and 045 closing available as balance statuses, 195 incoming money transfer and 175 cheque deposit package as credits, and 475 cheque paid as a debit
Read at raw.githubusercontent.com on the access date at the master branch: bai-codes.csv.
It is NOT an independent third reading. Its 469 rows agree character for character with the type-code tables in both the Python and the Ruby implementations cited beside it — same descriptions, same en dashes, same two disagreements absent. So all three are copies of one transcription of the specification's table. It is cited because the CSV makes the range structure countable in a way the two code files do not, and it is cited at that strength. This site publishes the ranges and a handful of illustrative codes, never a code table presented as the list.
- Simplified educational illustration
Payments Signal editorial teaching models — Payments Signal
What this simplifies: Ten lines rather than a file, and one group and one account rather than the many a real transmission carries. All eight record codes are present —
01,02,03,16,88,49,98and99. That is the one thing here that is not a simplification. An earlier version of this note said six of the eight, and counting the lines shows otherwise. Every identifier is invented. The account number carries no deliberate defect because the United States publishes no check digit for one, which is a weaker guarantee than the Swedish and Polish samples on this site can give and is disclosed for that reason. The item-count field is left empty on all three balances; nothing read for this page says when a bank fills it. The continuation line is joined into the text field with a comma between, which is what one of the two implementations does when it merges — the specification's own rule for the join was not read. The record's terminating slash is part of the last field on each line rather than a field of its own. The highlight on a last field carries the slash with it. That is a property of counting commas rather than a defect, and the record page says where the closing slash sits. The eighty in the header's physical-record-length field is what search content describes as the layout width and is written here as an ordinary value rather than as a limit these lines were measured against.Used wherever diagrams, scenarios, figures, or example values are didactic constructions rather than sourced facts; every such use carries a simplifications disclosure. All people, companies, banks, and list entries in examples are fictional.