Skip to content

Migrate COBOL codebase to Java/Spring Boot application#67

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

Migrate COBOL codebase to Java/Spring Boot application#67
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1773424405-cobol-to-java-migration

Conversation

@devin-ai-integration
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot commented Mar 13, 2026

Migrate COBOL codebase to Java/Spring Boot application

Summary

Adds a complete java-migration/ directory containing a Spring Boot 3.2.5 (Java 17+) project that translates all 15 COBOL programs from the repository into idiomatic Java. The existing COBOL code is untouched.

Modules migrated (7 major + 5 utilities):

  • Data LayerAccount JPA entity + Spring Data repository replacing embedded SQL cursors
  • JSON/XML Serialization — Jackson @JsonProperty and JAXB @XmlRootElement/@XmlAttribute replacing JSON GENERATE/XML GENERATE
  • Batch Merge/Sort — Spring Batch config with two-pointer merge and Comparator-based sort
  • Report Writer — Plain-text formatter preserving 66-line pages and column positions
  • Subprogram Architecture — Singleton @Service simulating WORKING-STORAGE state retention, MutableString wrapper for by-reference semantics
  • UtilitiesStringUtils (TRIM/UNSTRING), NumericUtils (IS NUMERIC/NUMVAL), ComputationalTypes (COMP-3 packed decimal ↔ BigDecimal), SearchUtils (SEARCH/SEARCH ALL), RedefinesExample (ByteBuffer memory sharing)

Infrastructure: Maven build, Flyway migration from create_test_db.sql, PostgreSQL driver (production), H2 (tests), 98 passing JUnit 5 tests.

Review & Testing Checklist for Human

  • COMP-3 packed decimal logic (ComputationalTypes.comp3ToBigDecimal / bigDecimalToComp3): Bit-manipulation code had a bug during development (test byte arrays were wrong). Verify edge cases — zero values, max PIC sizes, odd vs even digit counts — against actual COBOL COMP-3 behavior.
  • RedefinesExample ByteBuffer overlay: The 30-byte shared array with hardcoded offsets (first name 0–9, last name 10–29, corp name 0–29) should be compared against redifines/redefines.cbl field definitions. Character encoding is assumed ASCII — verify this matches GnuCOBOL's encoding.
  • Spring Batch job wiring is untested: MergeSortBatchConfig defines @Bean methods for mergeSortJob/mergeSortStep with FlatFileItemReader/FlatFileItemWriter, but tests only exercise the pure-Java merge/sort methods. Consider running the actual batch job in an integration test.
  • SQL query portability: AccountRepository.searchAccounts() uses LIKE ... escape '' which was tested on H2 only. Verify it works on PostgreSQL. The Flyway migration (V1__create_accounts_table.sql) is also never executed in tests (Flyway is disabled, H2 uses ddl-auto: create-drop).
  • SubProgramService thread safety: Singleton with mutable instance fields and no synchronization. Fine for demonstrating COBOL semantics but would be a bug in a concurrent web application.

Recommended test plan: Clone the branch, run cd java-migration && mvn clean test to confirm 98 tests pass. Then compare a few key outputs side-by-side against actual COBOL program outputs (especially JSON/XML format and report layout) to verify semantic equivalence.

Notes


Open with Devin

Create java-migration/ directory with complete Spring Boot 3.2.5 project:

Modules migrated:
- Data Layer: Account JPA entity, repository, service (sql/sql_example.cbl)
- JSON Serialization: Jackson-based generation (json_generate/json_generate.cbl)
- XML Serialization: JAXB-based generation (xml_generate/xml_generate.cbl)
- Batch Processing: Spring Batch merge/sort (merge_sort/merge_sort_test.cbl)
- Report Generation: Text-based formatter (report_writer/report_test.cbl)
- Subprogram Architecture: State-retaining services (sub_program/*.cbl)
- Utilities: StringUtils, NumericUtils, ComputationalTypes, SearchUtils, RedefinesExample

Infrastructure:
- Maven build with Spring Boot 3.2.5, Java 17+
- Spring Data JPA with PostgreSQL driver
- Flyway migration from create_test_db.sql
- H2 in-memory database for tests
- application.yml and application-test.yml configs

Tests: 98 tests covering all modules (all passing)
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

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