GitHub Copilot & AI: Modernizing Legacy Systems

by Priyanka Patel

AI Rescues COBOL: Modernizing Mainframes Without Learning a 65-Year-Old Language

As millions of ATM transactions flow through aging systems daily, a surprising solution is emerging: artificial intelligence is enabling developers to modernize critical COBOL infrastructure without needing to become COBOL experts themselves.

The challenge of maintaining legacy systems built on COBOL, a programming language predating the internet, is immense. An estimated 200 billion lines of COBOL code still power essential functions in banking, insurance, and government, yet finding developers proficient in the language is increasingly difficult as the original programmers retire. But a new approach, leveraging tools like GitHub Copilot and AI agents, is offering a path forward.

“When this whole idea of Gen AI appeared, we were thinking about how we can actually use AI to solve this problem that has not been really solved yet,” explains Julia Kordick, a Microsoft Global Black Belt who is spearheading this modernization effort. Kordick’s success lies in her ability to apply AI expertise in collaboration with COBOL veterans – a partnership that proves you don’t need to master a legacy language to update it.

A Three-Step Framework for AI-Powered Legacy Modernization

Kordick and her team at Microsoft have developed a systematic framework, battle-tested and powered by GitHub Copilot, applicable to any legacy modernization project. The process centers around understanding, enriching, and automating.

Step 1: Code Preparation (Reverse Engineering)

The biggest hurdle with legacy systems is often a lack of understanding of what the code actually does. Organizations rely on these systems but struggle to decipher their inner workings. This is where GitHub Copilot acts as an “archaeological tool.” Instead of lengthy and expensive consultant engagements, AI can:

  • Extract business logic from legacy files.
  • Document everything in markdown for human review.
  • Automatically identify call chains and dependencies.
  • Clean up irrelevant comments and historical logs.
  • Add additional information as comments where needed.

As an example, GitHub Copilot can generate an analysis like this:

Business Logic Analysis Generated by GitHub Copilot

File Inventory

  • listings.cobol: List management functionality (~100 lines)
  • mainframe-example.cobol: Full mainframe program (~10K lines, high complexity)

Business Purpose

Customer account validation with balance checking

  • Validates account numbers against master file
  • Performs balance calculations with overdraft protection
  • Generates transaction logs for audit compliance

Dependencies Discovered

  • DB2 database connections via SQLCA
  • External validation service calls
  • Legacy print queue system

However, a key principle is to always have human experts review AI-generated analysis. While AI excels at pattern recognition, domain knowledge remains crucial for accurate business context.

Step 2: Enrichment (Making Code AI-Digestible)

To maximize AI’s effectiveness, providing context is essential. This involves several steps:

  • Translation: Translate any non-English comments into English, as models perform better with English context.
  • Structural Analysis: COBOL follows a rigid four-division structure: IDENTIFICATION DIVISION, ENVIRONMENT DIVISION, DATA DIVISION, and PROCEDURE DIVISION. Leveraging this predictability, developers can prompt Copilot to map these divisions and summarize their purpose. For example: “Identify all the divisions in this COBOL file and summarize what each one does.”
  • Documentation as Source of Truth: Saving all AI-generated output as markdown files creates a primary reference point. As Kordick emphasizes, “Everything that you let Copilot generate as a preparation, write it down as a markdown file so that it can actually reference these markdown files as source of truth.”

Interestingly, COBOL’s verbosity can be an advantage. Statements like ADD TOTAL-SALES TO ANNUAL-REVENUE are almost self-documenting, and Copilot can extract these business rules into natural language descriptions.

Step 3: Automation Aids (Scaling the Process)

Once individual files are analyzed and enriched, understanding the system as a whole becomes the next challenge. This is where automated workflows powered by AI agents come into play.

Kordick’s team utilizes Microsoft Semantic Kernel to orchestrate specialized agents, each with a specific task. This includes:

  • Call Chain Mapping: Generating Mermaid diagrams to visualize file interactions.
  • Test-Driven Modernization: Extracting business logic, generating test cases, and then creating modern code that passes those tests.
  • Dependency Optimization: Identifying and flagging opportunities to replace outdated third-party COBOL libraries with modern equivalents.

This framework transforms Copilot from a conversational tool into a production line, with each agent performing a specific function under the orchestration layer.

The Reality Check: It’s Not a Silver Bullet

Despite the promise, Kordick is realistic about the limitations. “Everyone who’s currently promising you, ‘hey, I can solve all your mainframe problems with just one click’ is lying to you,” she states.

The reality is that human validation remains essential, each COBOL codebase is unique, and the field of agentic AI is still in its early stages. Full automation is likely at least five years away. However, significant progress is achievable today.

Azure Samples Framework in Action

To facilitate adoption, Kordick and her team have open-sourced their entire framework, built with Microsoft Semantic Kernel. It includes:

  • Multiple specialized agents: DependencyMapperAgent, COBOLAnalyzerAgent, JavaConverterAgent.
  • Cost tracking (typically $2-5 per 1000 lines analyzed).
  • Human validation checkpoints.
  • A configuration and testing script (doctor.sh).

Developers can get started by forking the repository (aka.ms/cobol), setting up their Azure OpenAI endpoint (or using local models for sensitive data), and running the doctor.sh script. A quick setup is also available via the command line:

git clone https://github.com/Azure-Samples/Legacy-Modernization-Agents
cd Legacy-Modernization-Agents
./doctor.sh setup
./doctor.sh run

A Business Imperative, Not Just Technical Debt

This isn’t simply about resolving technical debt; it’s about business survival. The looming shortage of COBOL expertise poses a critical threat to organizations reliant on these systems. The traditional approach of expensive consultants and auto-generated, unmaintainable code is proving unsustainable.

The AI-powered approach offers a different path: understanding business logic with AI, generating human-readable modern code, and retaining control of intellectual property. “What a lot of customers do not want to actually give all their intellectual property like a hundred percent to a partner anymore, right? They want to keep it in check,” Kordick explains.

Your Path to Modernization Hero

Whether dealing with COBOL, ancient Java, or any legacy system, the path forward is clear:

  • Start Small: Begin with a manageable system (under 5,000 lines).
  • Analyze with Copilot: Use GitHub Copilot to analyze a single file and document your findings in markdown.
  • Build Your AI Toolkit: Experiment with the Azure Samples framework and learn prompt engineering.
  • Think Beyond Code: Consider nonfunctional requirements and plan for modern architecture.

Here’s a challenge: identify a legacy system in your organization – even six-month-old code qualifies. Use GitHub Copilot to generate business logic documentation, identify modernization opportunities, and create a migration plan with human validation checkpoints. Share your results on LinkedIn and connect with Julia Kordick for the latest updates.

The most powerful takeaway from this conversation is that AI doesn’t replace developer expertise; it amplifies it. COBOL experts provide irreplaceable domain knowledge, modern developers bring fresh architectural perspectives, and AI delivers pattern recognition and translation at scale. When these forces converge, legacy modernization transforms from an insurmountable challenge into an achievable project.

The best time to modernize legacy code was 10 years ago. The second-best time is now.

Special thanks to Julia Kordick, Microsoft Global Black Belt, for sharing her insights and experiences.

Ready to dive deeper? Explore the full blog post at aka.ms/cobol-blog and connect with Julia on LinkedIn for the latest updates.

The age of legacy code doesn’t have to be a barrier anymore. With the right AI tools and framework, even 65-year-old COBOL can become approachable, maintainable, and modern.

What legacy system will you modernize next? Start building now with GitHub Copilot.

Written by Andrea is a Senior Developer Advocate at GitHub with over a decade of experience in developer tools. She combines technical depth with a mission to make advanced technologies more accessible. After transitioning from Army service and construction management to software development, she brings a unique perspective to bridging complex engineering concepts with practical implementation. She lives in Florida with her Welsh partner, two sons, and two dogs, where she continues to drive innovation and support open source through GitHub’s global initiatives. Find her online @alacolombiadev.

You may also like

Leave a Comment