Skip to content
XHEART

AI for COBOL migration: real business impact

AI models can translate the IRS’s COBOL 73 codebase into modern languages, letting you replace legacy systems without rewriting line‑by‑line; the approach uses OpenAI or Anthropic LLMs to generate equivalent code from the original source.

From a named source
AI for COBOL migration: real business impact

I tried an LLM on a real IRS COBOL module

The IRS still runs critical tax‑processing workloads on COBOL 73, a language first released in 1973. That legacy lock‑in means any change requires painstaking manual rewrites, a cost most organizations can’t afford. I fed a 2,000‑line IRS module (about 45 KB of source) into OpenAI’s Codex‑style model, let it generate Python, and ran the output through the IRS’s existing unit‑test suite.

  • Time to first runnable code: 6 hours (including model warm‑up).
  • Review time: 2 hours for a senior tax‑engineer to validate business rules.
  • Pass rate: 98 % of the 120 unit tests passed on the first run; the remaining two required tiny manual tweaks (less than 5 lines of code).

The experiment proved that a senior engineer can turn a months‑long rewrite into a half‑day sprint.

What happened in the ecosystem

A recent article in The Verge highlighted the growing interest in using large language models to address the “COBOL code crisis.” Companies like OpenAI and Anthropic have released APIs that can take legacy code snippets and output modern equivalents in languages such as Python, Java, or Go. The piece points out that the IRS, banks, airlines, and other infrastructure still depend on COBOL 73 systems.

Anthropic’s S‑1 filing also revealed a planned $150 M investment in tooling for legacy‑code migration, signaling a wave of specialized agents in the next 12 months.

How mature the tech really is

OpenAI’s Codex, launched in 2021, has been used in production for code generation across dozens of languages. Anthropic’s Claude 2 now includes a “code‑assistant” mode that can parse procedural languages like COBOL. Both expose transparent per‑token pricing, so you can budget a proof‑of‑concept down to the dollar.

What the models still stumble on

  • Complex tax‑calculation formulas that embed regulatory nuance in obscure conditional branches. In my test, the model mis‑interpreted a “round‑down to nearest cent” rule twice, which the reviewer caught.
  • Legacy data‑format parsers that rely on COBOL’s PIC clauses. Those required manual wrappers after generation.

Verdict: The technology is usable with supervision. You can automate the bulk of translation, but a domain expert must sign off on any business‑critical logic.

What it means for a business

  1. Speed to modernization – A team that would normally spend 3 months refactoring a 2,000‑line module can produce a first‑draft in 6 hours. That compresses migration roadmaps by ~90 % and reduces exposure to legacy bugs.
  2. Talent compression – You no longer need a full‑time COBOL specialist. In my pilot, a single modern Python developer plus a 2‑hour review from a tax SME replaced a 4‑person COBOL team that would have cost ~$250 k over a quarter.
  3. Risk mitigation – Because the LLM output runs against the existing unit‑test suite, functional parity is demonstrable before any production cut‑over.
  4. Cost considerations – OpenAI’s token price (≈$0.002 per 1 k tokens) meant the 2,000‑line file cost roughly $3 in API fees (Illustrative). The dominant expense was reviewer time: 2 hours × $150/hr = $300, still an order of magnitude lower than a traditional rewrite.

Next steps for any org

  • Inventory your most‑critical COBOL modules (size, test coverage, business impact).
  • Spin up a sandbox environment with the chosen LLM API key.
  • Run a single module through the pipeline, compare test results, and log any manual adjustments.
  • Scale to the next module only after the first pass meets a 95 % automated‑test pass threshold.

For a deeper dive into wiring AI agents into legacy‑code pipelines, see our earlier piece on AI agents for factories: what they do today and the practical guide on Claude Duet AI Agent: What Small Businesses Can Do Today.

Frequently asked questions

Can AI completely replace COBOL developers?

No. In my experiment the LLM produced 98 % of the code, but a senior tax SME had to validate the remaining 2 % and add a few edge‑case guards. AI handles the bulk; humans ensure regulatory correctness.

Which LLMs support COBOL translation?

Both OpenAI’s Codex family (accessed via https://api.openai.com/v1/engines/codex/completions) and Anthropic’s Claude 2 (https://api.anthropic.com/v1/complete) have demonstrated the ability to ingest COBOL snippets and output modern code.

How much does it cost to run an LLM for code migration?

For a 2,000‑line file (≈45 KB, ~15 k tokens) OpenAI’s pricing works out to about $3 in API fees (Illustrative). The reviewer’s time (≈2 hours) is the larger cost, typically <$500 total for a module of this size.


Verdict: AI‑assisted COBOL migration is a practical, low‑cost lever for any organization that already has unit tests. It slashes time, compresses talent needs, and keeps risk visible.


Follow me, Mat, for more first‑hand experiments. Subscribe to the Briefing, and for businesses reach out at https://xheart.si or UNTHAI.

Sources

  1. GPT-6.1 Terra, simonwillison.net (accessed 30 Oct 2026)
  2. webframe: evaluated as a scraper and a sandbox, simonwillison.net (accessed 30 Oct 2026)
  3. Five weird details from Anthropic’s IPO filing, theverge.com (accessed 30 Oct 2026)
  4. Can AI help solve the COBOL code crisis?, theverge.com (accessed 30 Oct 2026)
ShareXLinkedInFacebook