Skip to main content

IBM taps watsonx generative AI to help modernize COBOL on mainframes

IBM Logo
IBM logo is seen on Gae Aulenti square in Milano, Italy, on December 23 2019
Image Credit: Mairo Cinquetti/NurPhoto via Getty Images

Join our daily and weekly newsletters for the latest updates and exclusive content on industry-leading AI coverage. Learn More


COBOL is not a language often mentioned as a leading programming development one, at least not in 2023. That wasn’t always the case. COBOL, which debuted in 1959, was a leading language in the earliest era of computing and there are still billions of lines of COBOL code running production applications today.

Today, IBM announced a new initiative that uses the power of generative AI large language models (LLMs) to help bring COBOL applications into the modern era. Among the places that COBOL code continues to run is on IBM System Z (commonly just referred to as “Z”) mainframes. 

The new watsonx code assistant for Z service makes use of IBM’s watsonx LLMs for code development to help migrate COBOL applications to more modern Java application code. By modernizing applications incrementally on the mainframe using gen AI, IBM aims to help clients tackle talent gaps and take advantage of Java skills while reducing risk.

IBM first detailed its watsonx product platform in May during its Think conference as an effort to build out a series of foundation models for AI, designed for enterprise use cases.

“We’re really seeing the use of generative AI for code assistance becoming a key use case and emerging market trends,” Skyla Loomis, VP for IBM Z Software, said during a press briefing. “Generative AI can help developers to more quickly assess, update and test the right code.”

Why updating COBOL is critical 

A key challenge with COBOL code is that there is a shrinking base of developers who actually know how to maintain it.

Loomis noted that approximately 84% of IBM’s Z mainframe clients are running COBOL applications. As such, there is a real imperative to help organizations modernize the code in a way that can be more easily maintained. With the lack of COBOL skills, IBM took specific aim at training its AI so it could actually understand the ancient programming language.

In the press briefing, Kyle Charlet, CTO for IBM Z Software, explained how the watsonx code assistant was trained to be aware of COBOL code. Charlet said that watsonx code assistant was originally trained on CodeNet, one of the largest code data stores on the planet. In addition to the CodeNet code, he noted that IBM is also actively training and tuning the watsonx model.

“Enterprise Z COBOL is where we’re further tuning that model and handing it a bunch of COBOL Java pairs so that it understands exactly how to tune that model,” he said.

How generative AI transforms ancient COBOL code into modern Java

The watsonx code assistant can be used to analyze, refactor, transform and validate COBOL applications using gen AI.

Charlet said that the new offering can be used to “surgically extract” a logical business service from a large monolithic COBOL application. The watsonx code assistant can then be used to generate a Java class hierarchy and transform the extracted COBOL code to Java. To validate the transformation, the solution generates automated tests to ensure the new Java code is semantically equivalent to the original COBOL.

Charlet explained that the watsonx code assistant is not doing a line-by-line COBOL syntax translation to Java. That would lead to COBOL syntax expressed in Java, he noted, which in his experience is largely unreadable and unmaintainable. The IBM approach is to take the intention of the COBOL code and map it into Java code that makes sense.

“This Java has to be recognizable and maintainable by Java professionals and quite frankly, it is,” said Charlet.

IBM watsonx code assistant is able to create a symatic equivalent of COBOL in modern Java application code.

Why code doesn’t lie or hallucinate, like text

A common risk with gen AI technology is that of hallucination, output that is not accurate.

While hallucination tends to be common problem with AI text generation, Charlet argued that it’s less likely with code in general for a number of reasons. He noted that with the interpretation of human language and potential hallucinations, an individual might not recognize the hallucination as an error. Text is subject to interpretation by humans; code however works somewhat differently than text.

In the watsonx code assistant case, he explained that IBM validates the code that is generated. The validation will immediately highlight any hallucinations because the code will not run as expected if at all. As such, Charlet noted that while hallucination can potentially occur with code generation, those hallucinations are not a matter of opinion and can be identified and corrected.

“Code doesn’t lie,” said Charlet. “Code is something that you follow and it’s a bunch of machine instructions.”