# Legacy Ledger & Payroll — Genyra

> 13 COBOL banking and payroll programs reconstructed in Rust with exact fixed-point arithmetic: 2,174 exact file comparisons against the originals, 0 failures.

Canonical page: https://genyra.com/engineering/lab/legacy-ledger

Thirteen COBOL programs from an open-source banking and payroll ledger, reconstructed as one standalone Rust application and compared byte for byte against the running originals: 2,174 exact file comparisons, 185,968 record images, zero failures, zero monetary tolerance.

## Why this case matters.

A ledger is where modernisation is least forgiving. Balances carry across days, interest compounds on rounded cents, fees have floors, journals grow, and a payroll batch writes packed-decimal pay stubs that a downstream system reads as bytes. Change the scale of one field or the rounding of one COMPUTE and the error is silent and permanent.

The original, Albert Mendes's COBOL Legacy Ledger, is a teaching system with nine banking programs and a payroll suite. Genyra reconstructed the verified scope as a single Rust binary with no COBOL, Python, database service or network at runtime, and built the harness that proves the two behave identically on the same inputs.

## What was preserved, what changed, how it was verified.

Preserved: every picture clause's scale, every ROUNDED and truncating assignment, the 70-byte account record and the journal layouts, status codes, the fixed-clock timestamps including the original's six-digit time quirk, the packed pay-stub bytes and the documented defects in the transfer, settlement and batch programs.

Changed: the language, the runtime and the safety. Monetary arithmetic uses integer cents with checked i128 intermediates; overflow is rejected instead of wrapping; malformed records return errors. One read-only usability fix in a report command is documented and kept outside the exact comparison corpus.

Verified: both implementations run 90 simulated days across six nodes, 860 operations and a 25-employee payroll on separate copies of the same inputs. After each applicable step, every account, journal and outbound file is compared as raw bytes.

## The boundary of the claim.

This is a simulator. The published equivalence shows that the reconstruction reproduces the original's behaviour on the recorded corpus under the recorded compiler and runtime profile. It does not certify the original's business rules, current tax calculations or regulatory compliance, and it is not evidence of z/OS or EBCDIC interoperability. The conversion report lists what a real financial deployment would still have to resolve.

## Questions we are asked

**Why compare files as bytes rather than compare balances?** Because a balance can match while a record does not: a different sign convention, a shifted field or a reordered journal would pass a numeric check and still break the next program that reads the file. Byte comparison of the complete file after each step catches all of it, with no judgement about which fields matter.

**How is COBOL ROUNDED reproduced in Rust?** As nearest, ties away from zero, applied at the receiving field, exactly where the COBOL statement applies it. Non-rounded assignments truncate toward zero. The decimal primitive also implements half-even and prohibited-inexact policies so that a different system's rule can be stated explicitly rather than assumed.

**What happens to a legacy defect during a faithful reconstruction?** It is preserved and documented. The ledger's transfer path, settlement description and batch program each carry a documented defect; the Rust code reproduces the observable behaviour so that the comparison is honest, and the report names each one so that a real migration can decide, with the business, what to correct.

## Related work

- [Engineering Lab](https://genyra.com/engineering/lab): Legacy system migration evidence: three COBOL applications replaced by verified Rust reconstructions, and a native Rust desktop measured against its original.
- [Hotel Operations](https://genyra.com/engineering/lab/hotel-operations): An eight-area COBOL hotel application rebuilt in Rust with exact-cent billing and persistent state: 7,351 exact record comparisons over 155 scenarios.
- [Legacy system modernisation](https://genyra.com/solutions/legacy-modernisation): Legacy modernization services: COBOL and mainframe application modernization to native software, not a conversion to the JVM estate that is now the next legacy.
- [Software archaeology](https://genyra.com/solutions/software-archaeology): Legacy code analysis: recover the architecture, dependencies, data flows and business rules inside COBOL, mainframe and Java systems nobody can fully explain.

Contact: contact@genyra.com

Genyra LLC and the Dubai business Genyra L.L.C-FZ / Genyra.ai are distinct entities. Project scope and the contracting entity are agreed explicitly.
