What the Model Reads in COBOL That a Reviewer Skips
The most useful thing a language model does with a COBOL estate is read all of it, in the same way, with no fatigue. A human reviewer working through a large legacy program has to triage: read the paragraphs that look important, skim the rest. A model asked the same six questions of every file has no skim mode.
Microsoft's write-up of its COBOL Agentic Migration Factory, built with the Danish banking IT consortium Bankdata, shows what those questions look like. The analyzer agent's prompt asks for the data divisions and their purpose, the procedure divisions and logic flow, every variable with its level, type, size, and group structure, the paragraphs and sections with their call relationships, embedded SQL and DB2 statements, and file access patterns tied to their FD linkage. A second agent builds copybook dependency and reverse-dependency maps and reports on coupling and circular dependencies. Per Microsoft, Bankdata serves eight member banks and still has more than 70 million lines of code on the mainframe. Nobody reads that much code in a consistent way, and consistency is the point. The reverse dependency map answers the question that makes change requests risky: if I touch this copybook, what else breaks?
Academic work offers a second piece of evidence, with modest numbers. Lei and colleagues at Queen's University and IBM proposed a two-agent approach to explaining COBOL at the function, file, and project level, evaluated on 14 open-source COBOL projects. At the file level, an LLM judge scored their explanations against a zero-shot prompting baseline on a ten-point scale. The 4.21, 10.72, and 14.68 percent improvements the paper reports for purpose, functionality, and clarity are relative gains in mean score: 6.41 to 6.68, 5.69 to 6.30, and 5.79 to 6.64. The judge compared the two approaches only on short files. Long files, the ones that exceed a model's token window, were assessed by two human annotators against the developers' own header comments, where the approach averaged 0.85 on purpose, 0.99 on functionality, and 0.91 on completeness. At the project level, the judge rated the generated description as matching or surpassing the project README in 9 of 11 projects, which is the 82 percent in the abstract, and the manual check confirmed the functionality was explained in 10 of 11. These are small samples and a modest lift over a plain prompt. They do suggest that explaining long files becomes tractable once the agents receive context from the surrounding codebase.
The Microsoft team also found a less obvious use. Its preparation steps include reverse engineering that extracts the essence of the business logic from the code, existing comments, technical documentation, user handbooks, and human subject matter experts. A further step translates code and comments, important, in the authors' words, when engineers or the model do not understand the language: "in Bankdata's case, the code was in Danish, a niche language not trained into every model." The model becomes the thing that reconciles those partial sources of truth into one written description. In many estates that description would be the first current documentation the program has had, and it is a deliverable in its own right, whether or not any Java ever ships.
The failures are specific, and they cluster. Microsoft reports that in its early agent experiments, built on AutoGen, too much context made the agents appear to run out of memory, lose coherence, and either hallucinate heavily or stop coding altogether. When context was kept short, the authors found the output surprisingly good. The team writes that it managed to reach call-chain level 3, "but not beyond." Its first experiments with GPT-4 chat and GitHub Copilot, from the end of 2024, produced what the authors call "a good mix of educated guesses (from us and the model) and hallucinational gibberish." The team later moved to Semantic Kernel for more robust orchestration, and the post does not say whether the depth limit survived the move. A call chain deeper than three levels is ordinary in a system that has been extended over a long life.
The IBM Research paper on evaluating COBOL to Java translation adds a second failure family. The authors note that LLMs used as judges of a translation often lack domain-specific knowledge of IBM middleware COBOL, such as CICS, which reduces the reliability and quality of their judgments. The finding concerns judging translations, and the middleware gap it describes plausibly affects reading code as well. It matters because the business logic in a bank or insurer rarely lives in plain COBOL statements alone. It lives in the EXEC CICS and EXEC SQL calls, in the transaction behavior around them, and in the batch orchestration outside the source file entirely. Microsoft makes a related point when it says many COBOL modules are tied to the non-functional behavior of the mainframe, such as batch throughput, I/O handling, JCL orchestration, and strict SLAs, and that some modules need a redesign while others need a closer look at those dependencies. A model reading the program text sees the program text. The JCL and the scheduler hold a different part of the behavior.
So I read the split this way. The model is strongest at breadth: every paragraph, every copybook, every variable, in one pass, written down in plain language. It is weakest where meaning depends on context outside the file, or on depth beyond a few call levels, or on middleware semantics it has seen less of. A human reviewer has the opposite profile. Depth and context are the reviewer's strengths, and breadth is where the reviewer quietly cuts corners.
The business consequence shows up in the order of operations. Microsoft names fewer experts, rising maintenance costs, and the loss of institutional knowledge as the pressures on COBOL estates. My reading is that an estate with undocumented logic and retiring authors has a cost curve that bends upward every year, because each departure removes a source of truth that cannot be recreated. Extracting the logic first, with a person validating the extraction against what they know, converts a risk that grows with time into an asset with a date on it. The Java comes later and matters less than the description it was generated from.
Which raises the question I keep coming back to. If the written description is the real product of this first stage, who signs it as correct? A model can produce a clean account of what a program does. Whether that account matches what the program actually does in production, on the odd inputs the original authors never wrote down, is a separate matter, and it deserves its own post.
Sources: Microsoft All Things Azure, "How We Use AI Agents for COBOL Migration and Mainframe Modernization" (Julia Kordick and Gustav Kaleta, Jul 9, 2025, devblogs.microsoft.com/all-things-azure); Lei et al., "Enhancing COBOL Code Explanations: A Multi-Agents Approach Using Large Language Models" (arXiv 2507.02182, Jul 2025); Froimovich et al., "Quality Evaluation of COBOL to Java Code Transformation," IBM Research (arXiv 2507.23356, Jul 2025).