Skip to content

feat: Modernize CBACT01C COBOL batch program to Java 17#166

Open
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1776438129-cobol-to-java-cbact01c
Open

feat: Modernize CBACT01C COBOL batch program to Java 17#166
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1776438129-cobol-to-java-cbact01c

Conversation

@devin-ai-integration
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot commented Apr 17, 2026

Summary

Rewrites the COBOL batch program CBACT01C.cbl (from the CardDemo mainframe application) as a standalone Java 17 CLI application under a new java-modernization/ directory. The program reads 300-byte fixed-length account records from a flat file and produces three output files (OUTFILE, ARRYFILE, VBRCFILE), replicating the original business logic:

  • Signed zoned-decimal parsing/encoding with ASCII trailing-overpunch ({/}, A-I/J-R)
  • Date conversion (YYYY-MM-DDYYYYMMDD) replacing the COBDATFT assembler routine
  • Default debit substitution (2525.00 when input debit is zero)
  • OCCURS array population with hard-coded slot values matching the COBOL logic
  • Variable-length record split (VB1: 12-byte status, VB2: 39-byte balance summary)

Includes 25 JUnit 5 tests covering parsing, encoding round-trips, date conversion, business logic, and full end-to-end execution against the repo's 50-record acctdata.txt sample file.

A detailed MIGRATION_NOTES.md documents every COBOL-to-Java field mapping for both copybooks (CVACT01Y, CODATECN) and all three output file formats.

Review & Testing Checklist for Human

  • Zoned-decimal encoding correctness: Verify the overpunch mapping in AccountRecord.parseSignedZonedDecimal() and OutputAccountRecord.formatSignedZoned() matches the COBOL ASCII zoned-decimal convention. The round-trip tests only cover a handful of values; negative inputs from real data are not represented in the sample file.
  • COMP-3 fields are NOT binary-identical: The COBOL USAGE IS COMP-3 fields (debit in OUTFILE/ARRYFILE) are rendered as human-readable signed strings (e.g., +000000252500) rather than actual packed-decimal bytes. If downstream consumers expect binary COMP-3, this will need a packed encoder. See formatComp3Display().
  • Field offset alignment: Confirm AccountRecord.parse() byte offsets match the CVACT01Y copybook exactly (300-byte record: 11+1+12+12+12+10+10+10+12+12+10+10+178). An off-by-one would silently corrupt fields.
  • No COBOL baseline output to diff against: Tests verify structural correctness and internal consistency, but there is no actual COBOL-produced output file in the repo to compare byte-for-byte. Consider running the COBOL program on a mainframe/emulator and diffing outputs if strict parity is required.
  • Test the build locally: cd java-modernization && JAVA_HOME=/path/to/jdk17 mvn clean test — all 25 tests should pass.

Notes

  • The original COBOL field name typo ACCT-EXPIRAION-DATE (missing 'T') is preserved intentionally in the Java field names for traceability.
  • All 50 sample records have zero debit, so the 2525.00 default substitution path is always exercised. The non-default path (copying the actual debit value) is only unit-tested, not exercised by the sample data.
  • ACCT-ADDR-ZIP is parsed from the input record for completeness but is not used by any business logic, matching the original COBOL behavior.

Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/afe3d671c8b04d79aa65ff258f98ca37


Open with Devin

- Rewrite CBACT01C.cbl as a Java 17 application using records, sealed types, and modern idioms
- Model all COBOL data structures (CVACT01Y, CODATECN copybooks) as Java records
- Implement DateConverter replacing the COBDATFT assembler routine
- Handle signed zoned-decimal (overpunch) encoding/decoding with full round-trip support
- Produce identical output files: OUTFILE, ARRYFILE, VBRCFILE
- Add 25 JUnit 5 tests covering parsing, encoding, date conversion, business logic, and end-to-end execution
- Include MIGRATION_NOTES.md with complete field mapping documentation
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 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 and CI monitoring

Copy link
Copy Markdown
Author

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

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.

0 participants