Skip to content

feat: COBOL-to-Java/Spring Boot Migration (Phase 0-3, 5) - Core Data Layer & Utilities#77

Open
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin/1776185383-cobol-to-java-migration
Open

feat: COBOL-to-Java/Spring Boot Migration (Phase 0-3, 5) - Core Data Layer & Utilities#77
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin/1776185383-cobol-to-java-migration

Conversation

@devin-ai-integration
Copy link
Copy Markdown

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

Summary

Adds a new migration/ directory containing a Spring Boot 3.2 / Java 17 project that migrates core COBOL programs to Java. This covers Phases 0–3 and 5 of the migration plan:

  • Models: Account (from sql/sql_example.cbl), Customer (from redifines/redefines.cbl REDEFINES), Item (from search/search.cbl with Comparable matching COBOL ascending/descending keys)
  • Utilities: StringUtils (TRIM + UNSTRING with pointer/tallying), NumericUtils (IS NUMERIC + NUMVAL)
  • Services: SearchService (binary search via Collections.binarySearch, linear search via predicate)
  • Repository: AccountRepository (JPA queries replacing three COBOL cursor declarations)
  • Serialization: JsonService (Jackson) and XmlService (JAXB) replacing COBOL JSON/XML GENERATE
  • Controller: AccountController REST endpoints replacing the COBOL menu-driven UI
  • Tests: 100 unit tests, all passing

See migration/README.md for the full COBOL→Java mapping table and build instructions.

Review & Testing Checklist for Human

  • Account.enabled boolean ↔ VARCHAR mapping: The enabled field is a Java boolean mapped to the is_enabled VARCHAR(1) column storing 'Y'/'N'. There is no JPA AttributeConverter — Hibernate will fail at runtime when connecting to the real PostgreSQL database. A @Convert annotation or YesNoConverter is needed before Phase 6.
  • Customer REDEFINES fidelity: COBOL REDEFINES shares memory — setting ws-corp-name overwrites ws-customer-first-name/ws-customer-last-name. The Java model uses separate fields, so they are independent. Verify this semantic gap is acceptable or if mutual exclusion logic should be enforced.
  • unstringFull vs COBOL ALL delimiter: COBOL DELIMITED BY ALL "<" collapses consecutive delimiters into one. The Java implementation splits on each individual occurrence. Test with consecutive delimiters to confirm behavior matches expectations.
  • @Column(length=...) vs real DB schema: Account uses @Column(length=8) etc. which may conflict with ddl-auto=validate if the real PostgreSQL schema uses unbounded varchar. Verify column lengths match sql/create_test_db.sql.
  • Run mvn test locally inside migration/ with Java 17 to confirm all 100 tests pass. Then try mvn spring-boot:run against a PostgreSQL instance seeded with sql/create_test_db.sql to verify the Account entity mapping works end-to-end (expect it to fail on the boolean mapping without a converter fix).

Notes

  • AccountController and AccountRepository have no dedicated tests — they are wired up but only exercisable via integration testing against a database.
  • isNumeric() trims input before checking digits, which diverges from raw COBOL IS NUMERIC on PIC X fields (where trailing spaces cause failure). This was an intentional convenience choice documented in the test comments.
  • .gitignore is included to exclude target/, IDE files, and OS artifacts from future commits.
  • No CI is configured for this repository, so tests were verified locally (100/100 passing).

Link to Devin session: https://app.devin.ai/sessions/9f54e86f9b2748c9bbe8e2a74db2436b
Requested by: @jerryoliphant-cog

- Phase 0: Spring Boot project structure with Maven, Java 17
- Phase 1a: Data models (Account, Customer, Item) migrated from COBOL
- Phase 1b: String & numeric utilities (StringUtils, NumericUtils)
- Phase 1c: Search service (binary + linear search)
- Phase 2: JPA repository replacing COBOL cursor declarations
- Phase 3: JSON/XML serialization (Jackson + JAXB)
- Phase 5: REST controller replacing menu-driven UI
- 100 unit tests, all passing
- Comprehensive README with migration mapping table

Co-Authored-By: Jerry Oliphant <jerry.oliphant@cognition.ai>
@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

Co-Authored-By: Jerry Oliphant <jerry.oliphant@cognition.ai>
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