Skip to content

Migrate COBOL scaffolding templates to Java (java/ Maven module) - #266

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1787064388-java-scaffolding
Open

devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1787064388-java-scaffolding

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Aug 18, 2026

Copy link
Copy Markdown

Summary

Adds a new top-level java/ Maven module containing Java equivalents of the four COBOL scaffolding templates in src/templates/ (originals untouched, kept for benchmark comparison). Base package com.cog.clbs, JDK 17, JUnit 5.

Mapping (full table in java/README.md):

  • standard-program.cblAbstractProgram (final run() drives initialize()execute() loop until end-of-file → terminate(), with handleError() defaulting to RC 8) + ReturnCode enum for the RC 0/4/8/12/16 framework; setReturnCode never lowers severity.
  • file-handling.cblVsamFile<V> (TreeMap-backed KSDS: read/write/rewrite/delete/readNext with FileStatus codes '00'/'10'/'22'/'23') and SequentialFile (line-record I/O with AT-END semantics).
  • db2-handling.cblDb2Handler over JDBC (connect/attach, PreparedStatement as host variables, ResultSet as cursor, commit/rollback, CONNECT RESET → disconnect()) + SqlCodeException carrying SQLCODE.
  • error-handling.cbl + ERRHND.cpy/ERRHNDL.cblErrorHandler (severity counts, P300-style message formatting, P400 action determination, 8000-CHECK-FINAL-STATUS → finalReturnCode()), ErrorRecord mirroring the copybook fields, ErrorSeverity (F/W/I) and ErrorAction (R/C/A) enums.

mvn compile and mvn test pass (17 smoke tests across the four components).

Link to Devin session: https://app.devin.ai/sessions/47f444e0c8ab4288978a21d976e479d6


Devin Review

Status Commit
⚪ Not started

Run Devin Review

Open in Devin Review (Staging)

Co-Authored-By: Abhay Aggarwal <abhay.aggarwal@codeium.com>
@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, CI, and merge conflict monitoring

@devin-ai-integration

Copy link
Copy Markdown
Author

End-to-end test results for the java/ scaffolding module

Ran a clean build/test plus an adversarial runtime harness against the compiled classes (JDK 21, Maven 3.6.3).

  • mvn clean test: BUILD SUCCESS — Tests run: 17, Failures: 0, Errors: 0, Skipped: 0 (AbstractProgramTest 4, Db2HandlerTest 3, ErrorHandlerTest 7, FileHandlingTest 3)
Adversarial runtime checks (24/24 passed)
  • VsamFile: duplicate WRITE → DUPLICATE_KEY (22); READ missing key → empty + RECORD_NOT_FOUND (23); READ NEXT past last key → END_OF_FILE (10); op before OPEN → FILE_NOT_OPEN; REWRITE/DELETE missing → RECORD_NOT_FOUND
  • SequentialFile: OPEN OUTPUT/WRITE/CLOSE, reopen INPUT, reads return records in order, read past last → empty + END_OF_FILE (10) (AT END)
  • ErrorHandler: FATAL → ABEND + abendRequested + final RC SEVERE (12); recordError → RC ERROR (8); WARNING → CONTINUE + RC WARNING (4); clean → RC SUCCESS (0); message formatted Error in PGM1 - boom (T123)
  • AbstractProgram: normal lifecycle → RC 0; execute() throwing → RC 8 via 9000-HANDLE-ERROR path; RC never lowered (12 then 4 → stays 12)

Not covered: Db2Handler against a live JDBC database (no DB in the test environment; verified via its unit tests only).

Tested by Devin — session

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