cd /news/ai-tools/does-your-cobol-rewrite-still-give-t… · home › topics › ai-tools › article
[ARTICLE · art-182109] src=dev.to ↗ pub= topic=ai-tools verified=true sentiment=↑ positive

Does your COBOL rewrite still give the same answers? I built a séance to find out

A developer built Necromancer, a browser app that runs legacy COBOL programs and differentially tests AI-generated rewrites against them to catch silent behavioral drift. On a bundled payroll program, an AI-style JavaScript port disagreed with the original COBOL on 947 of 2,000 inputs, rounding where COBOL truncates and retaining digits COBOL silently drops, while the port Necromancer generated disagreed on none of the tested inputs. The tool also surfaced an unplanned bug in a loan program whose PIC 999 month counter wraps from 999 to 000, leaving the loop unable to terminate.

recommendation

Run differential tests of rewritten legacy code against the original on large input sets, and encode COBOL decimal truncation and field-width rules as explicit correctness properties before trusting an AI port.

more in playbook: Evals and testing for LLM apps
by read2 min views1 publishedDec 4, 2026

Written as part of the Kiroween 2026 hackathon.

Necromancer! Built with Kiro Web.

Banks, insurers and governments still run programs written in COBOL decades ago. When a team replaces one, often with AI help now, the new code usually reads well and passes a few spot checks. The trouble is behavior nobody wrote down, because it lives in the data definitions, not in the logic.

Take this line from a payroll program:

01  GROSS-PAY  PIC 9(5)V99.

It means five digits before the decimal point and two after. Store 464,000 in it and COBOL keeps 64,000, without an error. Compute 0.90 hours at 0.01 an hour and COBOL stores 0.00, because without the word ROUNDED it cuts extra decimals instead of rounding them. A JavaScript rewrite keeps 464,000 and rounds to 0.01. Nothing crashes. The numbers are just different.

For Kiroween's Resurrection category I built Necromancer, a browser app that brings old COBOL back to life and checks rewrites against it:

requirements.md, including a section on the decimal rules a rewrite has to keep. On the bundled payroll program, an AI-style JavaScript port disagrees with the original on 947 of 2,000 inputs, in two ways: it rounds where COBOL cuts, and it keeps digits that COBOL silently drops. The port Necromancer generates disagreed on none of the inputs I tested.

The ghost I didn't plan for: a loan program counts months in a field declared PIC 999. At 999 months the counter goes from 999 back to 000, so the loop never ends. [Your reaction to that.]

BigInt. GO TO and file I/O, are reported with a line number instead of being skipped. [A sentence or two on how you worked with Kiro: what you asked for, what you decided, what you pushed back on.]

.kiro/specs was written afterwards to record the design and five correctness properties. My other Kiroween project, Gearwork, went spec first, and the property tests taken from its design caught two mistakes in the design itself. [Which way worked better for you, and why.].kiro out of .gitignore) and a "COBOL elder" review agent. They didn't run during the build, because my session's workspace was the folder above the repo.

── more in #ai-tools 4 stories · sorted by recency
── more on @necromancer 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/does-your-cobol-rewr…] indexed:0 read:2min 2026-12-04 · —