Migrate POSTTRAN STEP15 (CBTRN02C) to Java 21 + Spring Batch with byte-parity harness - #197
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
… with legacy parity harness Co-Authored-By: Parker Duff <pwjduff@gmail.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First migration slice of the CardDemo mainframe modernization:
POSTTRAN.jclSTEP15 →CBTRN02C(daily transaction posting) reimplemented in Java 21 + Spring Batch, with the legacy COBOL kept as
the reference oracle. Scope selection and the source map were approved in Phase 1; this PR is the
implementation and its evidence. No legacy source is modified.
The migrated step reproduces the legacy program byte for byte on both input sets — posted
transactions, account after-images, category balances, the reject file, SYSOUT and the return code:
One field is normalised out of the diff:
TRAN-PROC-TS, stamped fromFUNCTION CURRENT-DATE(
CBTRN02C.cbl:692-705) and therefore never equal across two runs. It is asserted separately forformat, and the migrated clock is injectable so a run can be pinned.
Reproduce with GnuCOBOL + Java 21 + Maven:
Why a generated mock set was needed
The shipped 300-record sample fires exactly one of the four reject reasons — all 38 rejects are
0102 OVERLIMIT. Reasons 100/101/103, the TCATBAL create branch, the negative-amount branch andboth
>=boundaries are never reached, so parity on it alone proves little.harness/gen_mock_data.pyderives inputs that reach all of them from the drop's own accounts, cardsand category balances (real records, real limits; boundary amounts computed from them), and the
legacy program's behaviour on each was recorded and matched rather than assumed.
That data exposed one ordering detail worth flagging, faithfully preserved in the port:
A transaction that is both overlimit and expired is reported as 103; the overlimit condition
leaves no trace in the reject record.
Implementation notes
overpunched sign, so the legacy program must be compiled
cobc -x -fsign=EBCDIC— without itGnuCOBOL reads every negative amount as positive, which is how the Phase 1 report's "43 rejects"
figure arose (corrected to 38 in this PR).
codec/Zonedimplements the same convention;BigDecimalcarries every amount.survive — a precondition for a byte-level diff.
io/KeyedStorestands in for the four VSAM KSDS: an in-memory keyed map unloaded in keyorder, which is what makes the diff against the legacy IDCAMS-style unload possible. Swapping in
a database is confined to that one class.
rewritten, so records are not independent.
TransactionPostercarries the COBOL paragraph name and cited source lines.What this does not prove
This is self-consistency parity against GnuCOBOL, not against z/OS — a mainframe baseline
(§6.1 of the Phase 1 report) is still needed to show the reference itself is faithful. The
CEE3ABDabend path and theTRANFILEOPEN OUTPUT/DISP=SHRquestion remain unvalidated, andparity covers one step, not the job stream.
Details:
migration/posttran/README.md; full source map and Phase 2 outcome indocs/phase1-posttran-inventory.md.Devin-Org: engineering
Link to Devin session: https://app.devin.ai/sessions/4e51bfff94734bab8893f0e376063f0d
Open in Devin Desktop: https://app.devin.ai/desktop/session/4e51bfff94734bab8893f0e376063f0d?variant=devin
Devin Review