Skip to content
AnthropicAnthropic

Claude Code modernizes a legacy COBOL codebase

Watch how Claude Code helps modernize a mainframe codebase. Starting with code from an AWS Mainframe Modernization demo environment, Claude Code analyzes business logic, dependencies, and data flows, then helps refactor it into Java while preserving functionality. Claude Code handles the complex, multi-step work—generating documentation, developing migration plans, writing test suites, and iteratively validating the new code—directly from your terminal.

Nov 14, 20254mWatch on YouTube ↗

EVERY SPOKEN WORD

  1. SP

    Let's explore how developers can use Claude Code to modernize a COBOL codebase. For the purposes of this demo, we'll use AWS Mainframe Modernization demo repository. This is a medium-sized credit card management system with around a hundred files, including COBOL programs, copybooks, and JCL scripts. Phase one, discovery and documentation. Our sample COBOL codebase has almost no documentation. This is of course common with legacy codebases where critical business logic and regulatory requirements are embedded within undocumented code. The developers who wrote the code have long since left the organization, and developers familiar with COBOL are hard to hire. We first create a specialized subagent using Claude Code/agent command. This was our COBOL documentation expert and translator. Subagents can be invoked by Claude Code in parallel, and they operate with their own isolated context windows to avoid polluting the main thread. We enabled thinking mode and asked Claude Code to analyze the architecture of the codebase. Claude Code created a to-do list of all ninety-four files and tracked its progress to ensure no files were processed twice and nothing was missed. The documentation Claude produced went beyond simple code comments. For example, let's look at the interest calculation program CBACT04C. It extracted the complete business workflow, how the program reads transaction category balances, looks up interest rates by account group, applies business rules for fallback rates, and updates account records. Claude did this for each file, but also created two memory files as plain text. Catalog.text translates cryptic names like CBACT04C into interest calculator batch program. Relationships.text maps every dependency using a simple pipe delimited format. Using these indices, Claude then generated mermaid diagrams, a complete map of the daily batch processing workflow, showing how the data flows from transaction input through posting, interest calculation, and finally to customer statements. In this demo, Claude Code ran continuously for an hour to draft over a hundred pages of documentation. But Claude Code is capable of running for over thirty hours autonomously, and the techniques used here scale to much, much larger codebases. Phase two, migration and verification. After thoroughly documenting the COBOL codebase, we asked Claude to migrate one of its core features to Java. We switched to planning mode to ensure Claude would think through the entire migration strategy without prematurely editing files. Claude analyzed the program formerly known as CBACT04C and identified complex COBOL patterns like line break processing and multi-file coordination. Claude developed a migration plan for this feature with five phases. One, create the project structure. Two, translate data models from copybooks to Java classes. Three, build the IO layer compatible with the original file formats. Four, convert business logic while preserving COBOL specific behaviors. And finally, create a dual test harness, one using GNU COBOL three point two point o for the original codebase, and one in Java seventeen. The resulting Java code went beyond a simple syntax translation. Claude created proper Java classes with appropriate design patterns, error handling, and logging. Idiomatic Java that a modern development team would actually maintain. Next was verification to ensure that the new Java code worked the same as the COBOL code it was replacing. Claude created multiple test data files and ran them against both the original COBOL and the new programs. The verification compared not just final outputs, but intermediate calculations, file writes, and data transformations. The result was perfect bit for bit fidelity. Every calculation, business rule, and edge case was preserved. Of course, this demo application is far smaller than your legacy COBOL codebases, but all the techniques here are scalable. Claude Code will empower your developers to modernize codebases with confidence and efficiency that simply would have been impossible just twelve months ago.

Episode duration: 4:14

Install uListen for AI-powered chat & search across the full episode — Get Full Transcript

Transcript of episode OwMu0pyYZBc

Get more out of YouTube videos.

High quality summaries for YouTube videos. Accurate transcripts to search & find moments. Powered by ChatGPT & Claude AI.

Add to Chrome