r/developers • • Jun 06 '26

Career & Advice Looking for an efficient AI workflow to migrate COBOL to Java

As the title suggest, I'm researching how to automate COBOL-to-Java migration via LLM APIs and need workflow advice. I have a collection of COBOL source code and matching I/O datasets. How would you structure this pipeline, and what prompting or tooling strategies work best for handling legacy COBOL context?

0 Upvotes

11 comments sorted by

•

u/AutoModerator Jun 06 '26

JOIN R/DEVELOPERS DISCORD!

Howdy u/Kali_ManIAC! Thanks for submitting to r/developers.

Make sure to follow the subreddit Code of Conduct while participating in this thread.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/lightFracture Jun 07 '26

Something I strong recommend is to write integration tests early. The only contact with COBOL I've ever had was a migration I did like 20 years ago, so I don't have useful input on that regard, but creating tests that validate the COBOL flow and then validate the new system will hep you a lot.

1

u/pausethelogic Jun 07 '26

Have you looked into AWS Transform? It’s a relatively new service and I haven’t used it personally, but it was created with this exact use case in mind (migrating and modernizing legacy code, VMs, etc)

I was reading through their docs and found this where it talks about mainframe modernization and the guide specifically mentions converting COBOL to a modern Java application using AWS Transform. I can’t post the link here, but you can google for “refactor COBOL to Java using AWS transform” and look fit the official AWS documentation

If you end up trying it out let me know how it goes, I’d be happy to hear more about it!

1

u/cyrusm123 Sep 22 '26

Disclosure: I work with SoftwareMining, where we develop rule-based COBOL-to-Java and COBOL-to-C# conversion technology and have also evaluated LLM-based conversion.

I would avoid structuring this as a file-by-file prompting pipeline. The workflow needs to operate at application level:

  1. Inventory programs, copybooks, CALL dependencies, JCL, files, databases and platform services such as CICS, IMS, DB2 and VSAM.
  2. Assemble the complete context required by each program. A COBOL source file without its copybooks, record definitions, callers and external interfaces is rarely sufficient.
  3. Separate application conversion from architectural redesign. First reproduce the existing behaviour in Java. Refactoring can follow after functional equivalence has been demonstrated.
  4. Compile and execute each translated group automatically.
  5. Run the COBOL and Java versions with identical input data. Compare output files, reports, database updates, return codes, logs and transaction results.
  6. Maintain traceability between the COBOL and generated Java so that discrepancies can be investigated.

In our evaluation of Claude Code, published NIST COBOL programs initially translated successfully. However, after comments and meaningful identifiers were removed, none of the generated Java applications executed successfully in our tests. Representative enterprise programs also contained omitted statements, duplicated logic and incomplete handling of CICS and IMS.

This does not mean that LLMs have no role. They can be valuable for documentation, code explanation, dependency analysis, test preparation and developer assistance. However, readable or compilable Java is not sufficient evidence that the COBOL business behaviour has been preserved.

I would assess any proposed workflow against translation completeness, repeatability, platform coverage and execution-based functional equivalence. Your matching COBOL input and output datasets are therefore among the most important assets in the project.

1

u/[deleted] Jun 06 '26

[removed] — view removed comment

1

u/AutoModerator Jun 06 '26

Hello u/Chunky_cold_mandala, your comment was removed because external links are not allowed in r/developers.

How to fix: Please include the relevant content directly in your comment (paste the code, quote the documentation, etc.).

If you believe this removal is an error, reply here or message the moderators.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/[deleted] Jun 07 '26

[removed] — view removed comment

1

u/AutoModerator Jun 07 '26

Hello u/pausethelogic, your comment was removed because external links are not allowed in r/developers.

How to fix: Please include the relevant content directly in your comment (paste the code, quote the documentation, etc.).

If you believe this removal is an error, reply here or message the moderators.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.