All posts Governance & Control

Legacy System Modernization With AI Agents: The Mainframe and COBOL Angle

AI agents vs human developers for COBOL modernization

In COBOL modernization, AI agents do discovery, call-chain mapping, first-draft Java and test generation; human developers and COBOL experts confirm the business rules, judge whether the tests are enough and approve cut-over.

The companies selling the agents draw the same line. Anthropic’s Claude Code guidance has the AI draft equivalence tests, then says: “Your team decides whether those tests are sufficient.” Cognition, which sells the Devin coding agent, writes that “autonomous transactional migrations remain beyond what agents can reliably do.”

TaskWhat agents doWhat people doSource
Discovery and inventoryMap programs, entry points, execution paths and data flows across the codebaseSet the scope, and decide whether a module can move at all, given batch throughput, JCL and SLAsAnthropic, Microsoft
Call-chain mappingTrace every CALL statement and draw the dependency graphCheck the deep chains: in a July 2025 test, Microsoft’s agents reached call depth 3 “but not beyond”GitHub, Microsoft
Business-rule recoveryExplain programs and individual business rules in plain languageSubject-matter experts confirm the intent; GitHub says to “always have human experts review AI-generated analysis”AWS, GitHub
Sequencing and target architectureSuggest an order from the risks, dependencies and complexity foundChoose the order, architecture and code standards; AWS refactors business domains “in a sequence defined by human oversight”Anthropic, AWS
TranslationWrite first-draft JavaReview behavior, reject Java that copies COBOL’s structure, and write the agent’s constraints: Itaú Unibanco’s experts put column limits and COMP handling into a playbookMicrosoft, Cognition
Test generationDraft equivalence tests and the JCL that collects test dataJudge whether the tests are enough; mainframe system programmers submit the jobs and move the dataAnthropic, AWS
Sign-off and cut-overRun old and new code side by side and compare outputsApprove the transition; engineer transactional cut-over with dual writes, incremental extraction and a gradual traffic shiftAnthropic, AWS, Cognition

The pattern holds in every row: agents are strongest at understanding and drafting, and weakest at guaranteeing correctness. GitHub’s October 2025 write-up of Microsoft’s COBOL work with Julia Kordick says it directly: “Full automation is probably at least five years away” (GitHub).

Key Takeaways

  • Agents draft, people decide. Agents map the code, convert COBOL to Java as a first draft and generate tests. COBOL experts own business intent, test sufficiency and cut-over.
  • Every named result is vendor-reported. AWS and Cognition report gains for Toyota Motor North America, BMW Group and Itaú Unibanco. We found no independent verification of any of them.
  • SAP custom code is the same problem in ABAP. Have agents sort the live Z-code from the dead and explain it before anyone deletes it.

Why mainframe and COBOL are the hardest legacy problem

COBOL is not a niche relic. IBM estimates roughly 250 billion lines of COBOL code in production (IBM), running the systems that clear payments, adjudicate claims and settle records. The problem is not that these systems fail; it is that the organizations running them can no longer easily change them. The code is decades old and sparsely documented, the programs are tightly coupled, and the people who wrote them are retiring.

The estate is European too. Bankdata, which runs IT for eight Danish banks with over 30% of the Danish banking market, had over 70 million lines of code on its mainframe in July 2025, according to Microsoft. Most of those systems, Microsoft writes, “are a good fit for the mainframe, some are not and would benefit from being re-platformed”, so its engineers ask a question first: “is the COBOL code actually modernizable?”

What results have companies seen from using AI agents to modernize COBOL?

AWS says Toyota Motor North America converted more than 40 million lines of COBOL to Java with AWS Transform and cut application discovery and planning by 75%, BMW Group cut testing time on a mainframe workload by 75%, and Cognition says Itaú Unibanco changed its corporate tax ID across hundreds of COBOL programs with zero production errors. All are vendor-reported, we found no independent verification of any of them, and none claims an unattended cut-over of a transactional system.

CompanyToolWhat was reportedReported by
Toyota Motor North AmericaAWS TransformMore than 40 million lines of COBOL converted to Java; modernization 50% faster; application discovery and planning cut by 75%AWS’s Ryan Peterson, via CIO Dive, Oct 2025
BMW Group, GermanyAWS Transform for mainframeTesting time down 75%, test coverage up 60% (mainframe workload; AWS does not name the language)AWS, Jan 2026
Itaú Unibanco, BrazilDevinCorporate tax ID changed across hundreds of COBOL programs and about 20 field variations, three months ahead of the government deadline, with “zero production errors”; migrations 5 to 6x fasterCognition, Apr 2026
NOSI (National Organization for Social Insurance), EgyptIBM watsonx Code Assistant for ZUp to 94% less time to find superfluous COBOL code (about 8 hours to 30 minutes); up to 79% less time to understand complex applications (24 to about 5 hours); 2023 pilotIBM, Mar 2025

Itaú’s refactor depended on the bank’s own COBOL experts, who traced the data at runtime, found the variations and encoded the constraints in the playbook Devin followed.

Can AI convert COBOL to Java?

Yes, as a first draft, not as a finished COBOL-to-Java migration. AWS Transform converts COBOL to Java and JCL to Groovy, combining deterministic refactoring with generative AI. IBM watsonx Code Assistant for Z converts COBOL to Java and generates unit tests that compare the new Java service with the original COBOL.

Neither proves equivalence on its own. The researchers who built the test framework for IBM’s watsonx Code Assistant for Z write that LLM-translated code “cannot be trusted to correctly translate the original code”, which makes manual validation necessary (Hans et al., April 2025). Two risks recur: JOBOL, meaning Java that copies COBOL’s structure, which Microsoft’s engineers set out to avoid; and behavior that lives outside the code, in batch throughput, JCL orchestration and SLAs.

Cognition draws the practical line: a batch job can be verified by replaying recorded COBOL inputs and matching the outputs, but a transactional system has no clean input and output pairs to test against, so it cannot yet be migrated autonomously.

SAP custom code migration: the Z-code is your unwritten process manual

Custom ABAP “can contain years of undocumented business logic” (Futurum), and Tim Wintrip of Lemongrass told TechTarget that some Z-code has been there for 20 years, “but you can’t just ignore it, because it may be doing something.” Much of it is also dead: surveys by SAP and others, cited in E-3 Magazine, find 60 to 80 percent of the custom extensions in heavily customized ECC systems no longer used. Sorting the live Z-code from the dead is the first job to give agents.

SAP’s custom code agents fix ABAP Test Cockpit findings and explain existing code before proposing changes, while “developers retain responsibility for judgment at critical steps involving business logic and architecture” (Futurum). At Festo, in Esslingen, SAP developers estimated one moderately complex modification at about five weeks; in an initial test run, the Nova Intelligence platform produced clean-core-compliant code in two (customer-reported, in an E-3 Magazine cover story by PAC analysts). DSAG’s 2026 investment survey shows how long DACH customers plan to stay on ECC: almost half of those still investing in it plan to switch to S/4HANA by the end of 2030, on Extended Maintenance at an additional cost.

Before an agent deletes or rewrites a Z object, find out which handoff it encodes. Our reading is that much custom code exists because the standard process stopped at a department boundary, exactly where nobody owns the handoffs. The traditional alternative, Gartner’s David Groombridge told TechTarget, is a global SI that will often “bring in a lot of consultants on a day rate” to find the customizations and migrate them by hand (how the delivery models compare).

Why most of these programs still fail, and how to avoid it

Legacy modernization inherits the failure pattern behind why enterprise AI pilots fail, where MIT NANDA found that about 95% of generative AI pilots at companies were failing (Fortune), and it adds four traps of its own:

  • Treating translation as modernization. Line-for-line conversion produces Java that thinks like COBOL, with the same undocumented assumptions. Modernization means reconstructing intent, not just syntax.
  • Skipping the validation gap. Without human-reviewed equivalence testing, a plausible-looking migration is a latent production incident; Sonar, which sells code verification, calls the real bottleneck “not generation, but trust.”
  • Losing the humans in the loop. COBOL experts are not obstacles to automate around; they are the only source of ground truth for whether reconstructed logic is correct.
  • No audit trail. In banking, insurance and government, an unauditable modernization is a non-starter with risk and compliance, so log every agent decision, transformation and human override (what an agent audit trail must record).

What to settle before committing

Start agents on discovery, documentation and dependency mapping, then settle three things before translation begins. First, validation: agent-generated equivalence tests and human sign-off for every migrated component that touches a critical workload. Second, who keeps the recovered knowledge. Microsoft’s engineers report that most mainframe customers they talk to “no longer favor an approach led by a GSI or specialized partner. They want to stay in control of their intellectual property, project progress, and costs” (Microsoft). Third, the test any partner should pass, Nucleo included: the business rules, call maps and test baselines end up in your repositories and your context engine, not in an integrator’s tooling. For the business case, see our enterprise AI agent ROI benchmarks for 2026.

Nucleo does not sell a migration tool or run a translation factory. Our forward-deployed engineers build the context engine first, the owned, model-agnostic intelligence layer your company runs on. The recovered knowledge lives there, so whichever model or migration tool runs on top reads from what you keep. See how an engagement works, or write to us.

Frequently asked questions

AI agents vs human developers for COBOL modernization: who does what?

Agents do discovery, call-chain mapping, first-draft Java and test generation. COBOL experts and developers confirm the business rules, judge whether the tests are sufficient and approve cut-over. Cognition, which sells a coding agent, writes that autonomous transactional migrations remain beyond what agents can reliably do.

Do we still need COBOL developers if agents do the work?

Yes. At Itaú Unibanco, the bank’s COBOL experts traced how data flowed at runtime, found roughly 20 variations of the corporate tax ID and encoded the constraints in the playbook Devin followed, according to Cognition. GitHub’s write-up of Microsoft’s COBOL work says humans must stay in the loop for validation.

What results have companies seen from using AI agents to modernize COBOL?

AWS says Toyota Motor North America converted more than 40 million lines of COBOL to Java with AWS Transform, and BMW Group cut testing time by 75% with AWS Transform for mainframe. Cognition says Itaú Unibanco changed its corporate tax ID across hundreds of COBOL programs with zero production errors. All are vendor-reported; we found no independent verification of any of them.

Can AI convert COBOL to Java?

Yes, as a first draft. AWS Transform and IBM watsonx Code Assistant for Z both convert COBOL to Java and generate tests, but the researchers who built the test framework for IBM’s tool write that LLM-translated code cannot be trusted without validation. Watch for Java that copies COBOL’s structure, and for batch throughput, JCL and SLAs that live outside the code.

How do AI agents help with SAP custom code migration?

Agents explain custom ABAP, fix ABAP Test Cockpit findings and draft clean-core code, while developers keep the judgment on business logic and architecture. In one proof-of-concept change at Festo that its SAP developers estimated at about five weeks, the Nova Intelligence platform produced clean-core-compliant code in two, according to Festo, as reported by E-3 Magazine.

How much COBOL is still in production?

IBM estimates roughly 250 billion lines of COBOL code in production worldwide. In Europe, Bankdata, which runs IT for eight Danish banks, had over 70 million lines of code on its mainframe in July 2025, according to Microsoft.

Why do so many AI modernization pilots fail?

MIT NANDA’s State of AI in Business 2025, as reported by Fortune, found that about 95% of generative AI pilots at companies were failing, with the vast majority delivering little to no measurable impact on P&L. In legacy modernization, failures also come from treating translation as modernization, skipping validation and removing the COBOL experts who know what the code should do.

What is the safest place to start with agentic modernization?

Discovery, documentation and dependency mapping. These phases change no production system, and the clearest published gains sit here: IBM reports that NOSI cut the time to analyze superfluous COBOL code by up to 94%. They also leave business rules, call maps and test baselines that your company keeps.

Sources: IBM, COBOL modernization; Anthropic, COBOL modernization with AI; Cognition, Devin and COBOL; Microsoft, AI agents for COBOL migration; GitHub, AI agents for legacy systems; AWS, Transform refactor approach; AWS, agentic AI and modernization; CIO Dive, AWS Transform; IBM, watsonx Code Assistant for Z; IBM, NOSI case study; Hans et al., arXiv 2504.10548; Sonar, COBOL is back; Futurum, agentic ABAP; TechTarget, SAP clean core; E-3 Magazine, SAP custom code; DSAG, Investment Report 2026; Fortune, MIT report.

The future belongs to those who see it before it is obvious, and build it while everyone else is still out there scouting for the best AI tools.