Migration and modernization at scale

AI doesn't analyse your legacy code: a parser does

By Xavier Franco, CEO de Elternativa · Grupo Zemsania
· 6 min read

Written with the help of AI and reviewed by Xavier Franco

Aerial view of an archaeological dig gridded with string, where every piece found is marked in its own square.
In this article

When people talk about modernising legacy systems with AI, the question I hear most is: «what if the AI makes up what my system does?». It's a very sensible question. And my answer is this: AI shouldn't analyse your code. A parser has to. AI comes afterwards, to explain it.

The real fear isn't the language

A legacy system isn't scary because it's written in COBOL, Visual Basic 6, Oracle Forms or PL/SQL. It's scary because nobody fully knows what it does. Decades of changes, business rules hidden inside a program, integrations that only one person understands, and documentation that stopped being updated years ago.

Before migrating, modernising or even maintaining a system like that, you have to understand it. And understanding it has to be something you can verify.

In practice: ask your team where the documentation for your oldest system is and how old it is. If they hesitate, you know where to start.

Why asking an AI isn't enough

Language models are extraordinary at explaining code. But they have a trait worth remembering: when they don't know something, they sometimes fill the gap with something that sounds right.

One study illustrates this very well. A group of researchers analysed 576,000 code samples generated by 16 models and found that 19.7% of the packages they recommended didn't exist. In total, more than 205,000 invented package names. It's one specific case, dependencies, but the pattern is general: a model can give an answer that is confident, well written and false.

If that model is the one telling you which business rules your billing system has, the risk is obvious. An invented rule gets migrated as if it were real. An omitted rule disappears silently.

Deterministic first, AI second

That's why, in our approach, the analysis is done in two layers:

  1. The parser reads the code. A deterministic analysis: the same code always gives the same result. It extracts programs, dependencies, data that is read and written, calls, conditions and rules. Every element is linked to the line of code it comes from.
  2. The AI explains it. On top of that analysis, the AI writes the functional and technical documentation in language the business understands. It explains, summarises and organises. But it doesn't make up what the program does, because the parser has already said so.

The difference is huge. With AI alone, you have an interpretation. With the parser in front, you have a map you can verify, and every sentence of the documentation can be traced back to its source.

In practice: when someone offers to document your system with AI, ask how they check that every documented rule exists in the code. If the answer is «we review it at the end», that's not enough.

The documentation you never had

The result of doing it this way is something many organisations have never had: functional and technical documentation extracted from the code itself, which says what the system does today, not what someone thought it did.

And it has an effect you notice straight away: what isn't used shows up. Programs nobody calls, reports nobody asks for, processes that stayed «just in case». Those aren't migrated: they're switched off.

The people who know it, validating

A parser doesn't replace the people who know the system. Quite the opposite: it gives them a tool. The two or three people who know why a rule exists, or which process must not be touched at month end, move on to validating the documentation extracted from the code, rule by rule.

Their knowledge, which today lives in their heads, ends up written down and linked to the code. To me, that's one of the best things about modernising a system like this: your key people stop being a risk and become the ones who give the green light.

In practice: sit your experts down with the documentation extracted from the code. If they validate it, you're halfway through the modernisation.

And then, compare with real data

Understanding the system is the first step. When it's rebuilt, the same principle applies at the end: the new and the old system run in parallel and are compared case by case, with your real data. Nothing is cut over until it matches.

That way, AI works on what it does best (explaining, writing, rebuilding) and the truth is provided by two things that don't hallucinate: the code and the data.

What to ask of anyone offering to document your legacy

There are more and more offers to document or modernise legacy systems with AI. Before choosing, I'd ask for five things:

  • Traceability: every documented rule says which program and which line it comes from.
  • Repeatability: the same code always gives the same analysis. If you run it twice and it changes, it isn't an analysis: it's an opinion.
  • Read-only: the scan reads your systems without touching or modifying them.
  • What isn't used, flagged: the inventory says what runs and what has been idle for years.
  • Validation by your people: your experts review the documentation before anything is rewritten.

If a proposal doesn't meet these five, the documentation may be beautiful, but you won't be able to rely on it to make decisions. And in a critical system, documentation you don't trust is almost worse than having none.

In practice: ask any provider to document one of your programs and point out, for each rule, the line it comes from. It's the quickest test.

Where to start

  1. Pick a bounded system with business value and someone who knows it.
  2. Inventory it read-only and extract its documentation from the code.
  3. Have your experts validate it rule by rule.
  4. Flag what isn't used and switch it off.
  5. Decide with that documentation whether to modernise, migrate or keep it as it is.

How we help

In Code and application migration we migrate COBOL and mainframe, Visual Basic 6, Access, Oracle Forms and PL/SQL to the language you choose. First we inventory the code read-only and document what it does by extracting it from the code, not from anyone's memory; then we rebuild it and cut over process by process with measured parity.

We do it with the Datagentis migration module, which scans your systems read-only, documents what they do and generates the plan to migrate what has to move.

Frequently asked questions

What is a legacy system?

An old system that is still critical to the business, often built on outdated technology, with little documentation and few people who understand it.

Can AI analyse legacy code?

It can explain it very well, but it shouldn't be the only source: models can give confident, false answers. A reliable analysis is done by a deterministic parser, and the AI explains it.

What is a deterministic code analysis?

One that always gives the same result for the same code, and where every rule is linked to the line it comes from.

How do you validate the documentation of a legacy system?

By having the people who know the system review it rule by rule, and then comparing the new system with the old one on real data.

Keep reading