Modern CardDemo
Autonomous best-effort modernization of AWS CardDemo from COBOL/CICS/VSAM/JCL into a small Python web/API application.
What This Preserves
- The original AWS CardDemo source clone is preserved at
../source. - Seed data is loaded from the original ASCII/EBCDIC files under
../source/app/data. - Fixed-width layouts are derived from CardDemo copybooks for customer, account, card, card xref, transaction, transaction type, transaction category, and user security records.
- The old system remains the behavioral oracle where it can be exercised. This lab does not require human approval; unresolved behavior becomes an assumption or gap receipt.
Modern Target
- Standard-library Python 3 application.
- SQLite persistence.
- JSON API plus browser UI.
- No external package install required.
- Batch/report parity surfaces for
TRANREPT,CREASTMT,INTCALC, andCOMBTRAN. - Batch resource setup/control parity metadata for
DEFGDGB,DEFGDGD,ESDSRRDS,TRANIDX,CLOSEFIL, andOPENFIL. - Signon, regular/admin menu routing, and SQLite-backed user security maintenance for
CC00,CM00,CA00,CU01,CU02, andCU03. - Transaction type maintenance for
CTTU, including type-code validation, update/insert, no-change rejection, and guarded delete. - MQ request/reply parity surfaces for
CDRDandCDRA, including source-shaped 1000-byte message metadata, system date/time reply formatting, and account inquiry overACCTDAT. - Pending authorization IMS/DB2/MQ parity surfaces for
CPVS,CPVD,CP00, andCBPAUP0J, seeded from the originalDBPAUTP0IMS unload.
Run
cd D:\scraper_storage\modernization_labs\aws-carddemo-modernization-20260523T073000Z\modern_carddemo
python -m carddemo.cli init-db --source-root ..\source --db-path .\carddemo.sqlite
python -m carddemo.cli serve --source-root ..\source --db-path .\carddemo.sqlite --port 8087
Open http://127.0.0.1:8087.
Test And Receipts
python -m unittest discover -s tests
python tools\generate_receipts.py --source-root ..\source --db-path .\carddemo.sqlite --out-dir .\reports
python tools\replay_static_oracles.py --source-root ..\source --out-dir .\reports
Receipt and replay generation write the capability-parity proof pack:
reports/capability_ledger.json: every discovered AWS CardDemo online and batch capability with source refs and proof grade.reports/golden_traces.json: deterministic service traces backed by legacy seed files or explicit inferred rules.reports/edge_cases.json: data- and copybook-derived edge cases to drive future parity closure.reports/next_gap_ranking.json: autonomous next-work queue, sorted by gap severity and capability priority.reports/static_oracle_replay.json: executable modern-service replay over the static/source-oracle trace pack, using a scratch SQLite database.
Proof grades are A for actual legacy runtime trace match, B for static legacy data/copybook oracle match, C for implemented or inferred without strict parity proof, and F for discovered capability gaps.
Added Batch/API Surfaces
GET /api/reports/transactions: seed-data transaction detail report following the legacyTRANREPTjoins and date filter shape.GET /api/statements/{account_id}: account statement text/HTML payload following theCREASTMTaccount, customer, card, transaction source sort, 80-byte statement line, and total-expense flow.GET /api/interest-projection:INTCALCformula preview usingTCATBALFandDISCGRPseed files.GET /api/batch/combined-transactions:COMBTRAN-style concatenation ofTRANSACT.BKUP(0)andSYSTRAN(0), ascendingTRAN-IDsort,TRANSACT.COMBINED(+1)output metadata, and transaction KSDS REPRO target metadata.GET /api/batch/transaction-master-backup:TRANBKP-style transaction master backup/redefine metadata, includingREPROCsource/backup datasets, IDCAMS delete targets, 350-byte KSDS record size, and 16-byte transaction-id key contract.GET /api/batch/transaction-type-extract:TRANEXTR-styleDSNTIAULextract for transaction type/category reference files, including backup/output datasets, ordered 60-byte records, and zero-fill suffixes.GET /api/batch/db2-reference-setup:CREADB21-style Db2 transaction reference setup, including free-plan/create/load step order, database/tablespace/table/index/grant metadata, load counts, and category-to-type restrict-delete foreign key.GET /api/batch/resource-setup: setup/control metadata forDEFGDGB,DEFGDGD,ESDSRRDS,TRANIDX,CLOSEFIL, andOPENFIL; passjob=<name>for one source job.GET/POST /api/mq/system-date:CDRD/CODATE01MQ request/reply model that returnsSYSTEM DATE : MM-DD-YYYYandSYSTEM TIME : HH:MM:SSusing the source reply labels.GET/POST /api/mq/account-inquiry:CDRA/COACCT01MQ request/reply model forINQAplus an 11-digit account key, returning labeledACCTDATaccount fields or the source-shaped invalid-parameters reply.GET /api/pending-authorizations/summary:CPVSpending authorization summary and five-row page flow over decodedPAUTSUM0/PAUTDTL1IMS unload records.GET /api/pending-authorizations/detail:CPVDpending authorization detail lookup by source-shaped authorization key or transaction id.POST /api/pending-authorizations/process:CP00authorization request processing with comma-delimited MQ request shape, available-credit decision, response CSV, summary update/insert, and detail insert.POST /api/pending-authorizations/fraud:CPVD/COPAUS2Cfraud mark/remove flow withAUTHFRDSshadow-table write.POST /api/batch/purge-authorizations:CBPAUP0J/CBPAUP0Cexpired authorization purge using the reverse-datePA-AUTH-DATE-9Ccalculation and summary counter adjustment.PATCH /api/accounts/{account_id}:CAUPaccount update flow with account/xref lookup, Y/N status validation, signed money/date validation, no-change rejection, and account/customer SQLite rewrites.GET /api/cards/{card_number}andPATCH /api/cards/{card_number}:CCDL/CCUPcard detail and update flow with account/card key validation, alphabetic embossed names, Y/N status, expiry month/year validation, no-change rejection, hidden-field preservation, and card SQLite rewrites.POST /api/transactions:CT02transaction-add flow with account/card xref lookup, confirmation, signed amount/date/merchant validation, transaction-id increment, andTRANSACTwrite without account-balance mutation.GET /api/transaction-types:CTLItransaction type list view with source-shaped seven-row cursor paging, forward/backward navigation, exact type-code filtering, andLIKEdescription filtering.POST /api/transaction-types,PATCH /api/transaction-types/{type_code}, andDELETE /api/transaction-types/{type_code}:CTTUtransaction type maintenance with two-digit numeric nonzero type codes, required alphanumeric descriptions, no-change rejection, update-or-insert behavior, and child-record delete protection.POST /api/batch/transaction-types:MNTTRDB2/COBTUPDTbatch transaction type maintenance over fixedINPFILErecords, includingAadd,Uupdate,Ddelete,*comment handling, return-code 4 error reporting, duplicate/missing-row SQL outcomes, and Db2 restrict-delete behavior.POST /api/post-transactions:POSTTRAN-style batch posting with card/account lookup, overlimit rejection, expiration rejection, category-balance update, and account cycle update.POST /api/signon:CC00signon over decodedUSRSEC, including uppercase credential normalization and admin/user menu routing.GET /api/menu/mainandGET /api/menu/admin:CM00andCA00menu option surfaces transcribed from the legacy menu copybooks/source.POST /api/users,PATCH /api/users/{user_id}, andDELETE /api/users/{user_id}:CU01,CU02, andCU03user maintenance flows over the modern SQLite user table, including source-shaped blank-field, duplicate, no-change, not-found, and non-admin user-type behavior.
Current Claim Limit
This is not claimed to be a proven production-equivalent replacement. It is a runnable modern target with seed-data parity checks, source fingerprints, tests, capability proof grades, gap ranking, and executable modern-service replay over static/source-oracle traces. Runtime parity against the original COBOL/CICS execution remains a gap unless a compatible mainframe or emulator harness is attached.