Articles

Blog section illustration

When AI Rewrites Your Mainframe: The Promise and the Fine Print

Author img

By Claus Villumsen

09 June, 2026

Share this article

AI Engineering Legacy Modernization ⏱ 12 min read 📅 May 2026

Pega just announced they can take your mainframe applications and use AI to reimagine them as cloud-native systems. It sounds like magic. Press a button, wait a bit, and out comes a modern application ready for AWS. But here's what nobody puts in the press release: what happens when the AI doesn't understand why your COBOL does that weird thing with the date fields every third Tuesday?

We've seen this movie before. New technology promises to solve the legacy problem. Consultants say yes. Vendors say absolutely. Three years later, you're still running the mainframe, only now you also have a half-finished modernization project and a team that doesn't trust anything with "AI-driven" in the name.

The difference this time might actually matter. AI-powered legacy code modernization tools have gotten good enough to do real work. Not all the work. Not the hardest parts. But enough that the equation has changed. The question isn't whether AI can help modernize your systems. It's whether you understand what it can do, what it can't, and what happens when you get those two things confused.

When was the last time you looked at your mainframe modernization strategy and asked not whether it would work, but whether you were solving the right problem in the first place?

What AI-Powered Legacy Code Modernization Actually Means

Let's start with what's real. Tools like Pega's new capability, and others in the market, use large language models trained on millions of lines of code to understand legacy applications. They can read COBOL, PL/I, Assembler. They can trace data flows. They can identify business logic buried in decades-old codebases that nobody alive fully understands anymore.

The AI doesn't just translate code from one language to another, it attempts to comprehend what the code is trying to accomplish. That's the breakthrough. Old-school migration tools did literal translation. If your COBOL had a weird workaround for a bug in a 1987 database driver, the translated code kept the workaround. The AI, in theory, recognizes that the workaround is obsolete and removes it.

In theory.

What actually happens depends on how much context the AI has, how well it's been trained on systems like yours, and how clearly your legacy code expresses its intent. A well-structured mainframe application with clear separation of concerns? The AI does surprisingly well. A 40-year-old system that's been patched by 200 different developers, where critical business rules live in Job Control Language comments? That's a different story.

The Part They Get Right

Here's what current AI-driven tools handle well. They're excellent at identifying patterns. Your legacy system probably has the same logic repeated in dozens of places with minor variations. Humans miss this. We see different variable names, different file structures, slightly different conditional logic, and we treat them as separate problems.

AI sees through that. It recognizes that these 47 different routines are all doing the same thing: validating customer account numbers. It can propose a single, modern service that replaces all of them. This kind of consolidation is where AI-powered legacy code modernization delivers immediate, measurable value.

They're also good at infrastructure translation. Moving from mainframe data structures to cloud-native databases, from batch processing to event-driven architectures, from monolithic deployments to containerized services. These are well-understood patterns. The AI has seen thousands of examples. It knows what works.

And they're fast. What would take a team of developers months to analyze, the AI does in days. Not perfectly. But fast enough that you can iterate, fast enough that you can explore multiple modernization paths, fast enough that the economics start to make sense.

The Part Where It Gets Complicated

Now let's talk about what happens when the AI encounters something it's never seen before. Because your mainframe application definitely has something it's never seen before. Every legacy system does. It's the nature of software that's been in production for decades.

Maybe it's a custom algorithm that a brilliant developer wrote in 1991 to handle a specific regulatory requirement. The regulation changed in 2003, but the algorithm is still there, slightly modified, and nobody's quite sure what it does anymore. The AI looks at this code and has to make a choice. Does it preserve the logic exactly? Does it try to modernize it? Does it flag it for human review?

The answer depends on the tool, the configuration, and honestly, a bit of luck. Some AI systems are conservative. They preserve anything they don't fully understand. You end up with modernized code that's still carrying 30 years of accumulated weirdness. Other systems are aggressive. They simplify, they optimize, they remove what looks like dead code. Sometimes they're right. Sometimes they just broke your month-end reconciliation process.

This is not a criticism of the technology. It's a description of reality. AI is probabilistic. It makes educated guesses based on patterns it's learned. When the pattern is clear, the guesses are good. When the pattern is unique to your business, your industry, your specific regulatory environment, the guesses are just guesses.

If your modernization strategy assumes the AI will handle everything, who's responsible when it makes the wrong guess about something critical? And how will you even know it made a guess in the first place?

The Knowledge Problem Nobody Talks About

Here's the deeper issue. Your mainframe applications don't just contain code. They contain decades of business knowledge. Decisions about how to handle edge cases. Workarounds for problems that nobody remembers. Optimizations for hardware that doesn't exist anymore but somehow the optimization is still necessary because the data model depends on it.

When you modernize, you're not just translating code. You're trying to extract that knowledge and carry it forward. Some of it's explicit. Most of it isn't. It's embedded in the structure, the flow, the weird way certain modules interact with each other.

AI can see the structure, but it can't always infer the intent. It can tell you that Module A calls Module B with specific parameters only on weekdays. It can't tell you that this is because of a handshake deal with a major client in 1995 that's still in effect even though nobody involved still works at either company.

This is where the promise of fully automated modernization hits reality. You still need people who understand the business. You still need domain experts who can look at what the AI produced and say "yes, that's right" or "no, that's going to cause problems in Q4 when we do the annual rollover." The AI accelerates the process. It doesn't eliminate the need for judgment.

Where AI Helps and Where Human Judgment Still Wins

Let's be specific about the division of labor. AI excels at the mechanical parts of modernization. Code translation, dependency mapping, infrastructure planning, identifying redundancy, generating modern API interfaces. These are tractable problems with clear patterns. The AI has been trained on enough examples to do good work.

Humans are still essential for everything that requires context. Deciding what to modernize first. Understanding which features are actually used versus which are just legacy baggage. Knowing which parts of the system are mission-critical and which can tolerate some risk during migration. Recognizing when the AI's suggestion is technically correct but operationally catastrophic.

The best outcomes happen when you use AI as a force multiplier for expert judgment, not a replacement for it. The AI does the heavy lifting of analysis and generates modernization options. Humans evaluate those options against business reality, regulatory requirements, operational constraints, and all the things that don't show up in the code.

This also means you can't just hand your mainframe to an AI tool and walk away. You need a team that understands both the legacy system and modern architectures. You need governance around what the AI is allowed to change automatically and what requires human approval. You need testing strategies that verify not just that the new code works, but that it works the same way the old code worked for the cases that matter.

AI is getting better at this. Models are learning more context. Tools are getting smarter about flagging uncertainty. But we're not at the point where you can treat mainframe modernization as a fully automated process. We might never be, because the real complexity isn't in the code. It's in the accumulated business logic that the code represents.

What This Means for Your Modernization Strategy

So where does this leave you? If you're responsible for a legacy mainframe system, AI-powered modernization tools are now good enough to be part of your strategy. They're not good enough to be the entire strategy.

Start by understanding what you actually need to modernize. Not everything. Not all at once. What are the parts of your system that are costing you the most, either in maintenance, in operational risk, or in missed opportunities because you can't change fast enough? Those are your candidates.

Use AI to accelerate analysis and generate options, but keep expert humans in the decision loop. Let the AI show you what's possible. Let it do the tedious work of mapping dependencies and translating code. But don't let it make irreversible decisions about business logic without human oversight.

Build in validation at every step. When the AI modernizes a component, test it not just against the functional requirements, but against production data, edge cases, and the scenarios that only happen twice a year but absolutely have to work. The AI can help generate test cases, but you need people who know what actually matters.

And be honest about risk. AI-driven modernization is faster and cheaper than traditional approaches. It's not zero-risk. You're still making substantial changes to systems that run your business. The fact that an AI helped make those changes doesn't make them automatically safe. It makes them faster to implement, which means you need to be thoughtful about where and how you use that speed.

If you started your mainframe modernization project tomorrow with AI doing the heavy lifting, what would be the one thing you'd absolutely insist on keeping under human control? And is that actually where your current strategy focuses attention?

Kodebaze combines AI-powered analysis with expert oversight to modernize legacy systems without the guesswork, giving you clear options and real control at every step. See how it works →

Related articles

Blog section illustration

AI

The Continuous Modernization Pipeline: How to Keep Modernizing Without Stopping to Ship
Most modernization programs stall because they are designed as projects with a start and end date. The organizations winning in 2026 treat modernization as a permanent pipeline — embedded in every sprint, measured like delivery, and impossible to pause without also pausing shipping.
Author img
By  Claus Villumsen
14 April, 2026
Blog section illustration

AI

AI vs. Consulting for Legacy Modernization: An Honest CTO's Guide
You have a legacy system holding your business hostage. A consulting firm costs a fortune. AI tooling sounds risky. An honest CTO’s guide to what each approach actually delivers — and how to combine them without getting burned.
Author img
By  Claus Villumsen
17 April, 2026
Blog section illustration

AI

How to Assess and Roadmap a Large Legacy Estate: A CTO's Field Guide
Someone handed you a list of 23 legacy systems and said “make a plan.” No documentation, no ownership map, no clear budget. This is the practical field guide for how CTOs actually assess a large legacy estate and build a modernization roadmap that gets funded and executed.
Author img
By  Claus Villumsen
16 April, 2026

AI + Human software Solution

Follow us

© 2026 Kodebaze. All Rights Reserved.