Skip to content

CardDemo Java modernization: Spring Boot foundation (copybooks → JPA model) - #186

Open
devanshi-gpta wants to merge 1 commit into
mainfrom
devin/1786577620-carddemo-java-foundation
Open

devanshi-gpta wants to merge 1 commit into
mainfrom
devin/1786577620-carddemo-java-foundation

Conversation

@devanshi-gpta

@devanshi-gpta devanshi-gpta commented Aug 12, 2026

Copy link
Copy Markdown

Summary

First layer of the COBOL → Java/Spring Boot migration: a standalone Maven module in java/ that carries the data model every migrated program depends on. No app/ artifact is touched; the COBOL/CICS/VSAM/JCL sources remain the reference implementation.

What it establishes:

  • Copybook → entity mapping. Each app/cpy/*.cpy record layout becomes a JPA entity whose Javadoc names the copybook and VSAM file, and whose fields carry the original PIC clause: PIC X(n)String with length = n, PIC 9(n)Integer/Long by digit count, PIC S9(m)V99BigDecimal(m+2, 2). Group keys (TRAN-CAT-KEY, DIS-GROUP-KEY) become @Embeddable composite ids.
  • VSAM KSDS → Spring Data. Repositories mirror the access paths the COBOL uses, including the alternate-index reads (findByAccountIdOrderByCardNumber for the CARDDATA/CARDXREF AIX paths).
  • COMMAREA → session DTO. CardDemoCommarea reproduces COCOM01Y field-for-field; pseudo-conversational state will live in the HTTP session under CardDemoCommarea.SESSION_KEY instead of being passed on EXEC CICS RETURN.
  • Zoned decimal handling. CobolUtils.decimal decodes the sign overpunch in the sample extracts ({=+0, AI=+1..+9, }=-0, JR=-1..-9), so "0000009190}" at scale 2 → -919.00. rounded() gives COBOL ROUNDED (HALF_UP) semantics for the interest math landing in a later PR.
  • Load JCL → SeedDataLoader. Replaces ACCTFILE/CARDFILE/CUSTFILE/XREFFILE/DISCGRP/TCATBALF/TRANTYPE/TRANCATG/DUSRSECJ by parsing app/data/ASCII at startup (toggle: carddemo.data.load-on-startup).

Worth flagging: acctdata.txt puts the disclosure group value (A000000000) in the ACCT-ADDR-ZIP byte range and leaves ACCT-GROUP-ID blank. The loader follows the CVACT01Y offsets rather than "fixing" the data, so interest calculation will fall back to the DEFAULT disclosure group exactly as CBACT04C does on the mainframe.

Tests: CobolUtilsTest (overpunch/rounding/padding), SeedDataLoaderTest (each layout asserted against the real sample records), and a context test asserting 50 accounts/cards/customers load.

Follow-up PRs (batch programs CB*, online programs CO*) branch off this one.

Link to Devin session: https://app.devin.ai/sessions/5409e398c7304f249331d08190d3abd3
Requested by: @devanshi-gpta


Devin Review

Status Commit
⚪ Not started

Run Devin Review

Open in Devin Review (Staging)

Maven module under java/ with copybook-derived JPA entities, Spring Data
repositories, COMMAREA DTO, zoned-decimal helpers and a loader for the
sample VSAM extracts in app/data/ASCII.

Co-Authored-By: Devanshi Gupta <devanshi.gupta@cognition.ai>
@devin-ai-integration

Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant