IBM’s generative AI tool aims to refactor ancient COBOL code for its mainframes

by owner

COBOL 73 running on an IRS computer in an emulator
Enlarge / COBOL 73, as seen (inside Windows) in the IRS’s Austin, Texas, offices in 2022.

Washington Post / Getty Images

There are hundreds of billions of lines of COBOL code running on production systems worldwide. That’s not ideal for a language over 60 years old and whose primary architects are mostly retired or dead.

IBM, eager to keep those legacy functions on its Z mainframe systems, wants that code rewritten in Java. It tried getting humans to do it a few years back, but now it has another idea. Yes, you guessed it: It’s putting AI on the job.

The IBM watsonx Code Assistant, slated to be available in Q4 this year, intends to keep humans in the mix, but with a push from generative AI in analyzing, refactoring, and testing the new object-oriented code. It’s not an all-or-nothing process, either, as IBM claims that watsonx-generated code should be interoperable with COBOL and certain Z mainframe functions.

In a technical blog post specific to COBOL conversion, IBM’s Kyle Charlet, CTO for zSystems software, steps up to the plate and says what a lot of people have said about COBOL: It’s not just the code; it’s the business logic, the edge-cases, and the institutional memory, or the lack thereof.

Some clients… have spent years and millions trying to modernize their COBOL code, and despite all that, only a fraction has been modernized. It takes lots of developers and painstaking manual work to rewrite COBOL. People have tried many different ways to modernize these applications, and in my experience, with varied results. None are exemplary.

IBM’s watsonx, Charlet writes, could help large organizations decouple individual services from monolithic COBOL apps. In IBM’s view, it will come in three steps:

  • Refactor, in which individual services are “surgically” separated or extracted from larger code
  • Transform, either to mainframe-friendly Java code or COBOL that can speak directly to Java
  • Validate, with AI helping to create test cases but with coders still “in the driver’s seat”

IBM’s walk-through of how its AI-based watsonx Code Assistant can “Refactor, Transform, and Validate.”

In some ways, AI assistance seems like it can only help with the generational challenge of moving COBOL forward while keeping it functional. While COBOL codebases can be relatively stable and secure—once found to be among the least problematic in a broad survey—the costs of updating and extending them are gigantic. Legacy COBOL was one of the reasons the Office of Personnel Management suffered a deeply intrusive break-in in 2015, as the antiquated code could not be encrypted or made to work with other secure systems.

But there’s a recurring argument that COBOL is good at managing business-specific systems and exchanges in ways that (some might argue) present fewer attack vectors. Or you might argue that AI-generated and restructured code might look proper and seem test-ready, but without the people around who know exactly why the code does the things it does, AI-upscaled code could have just as much noise as AI-upscaled video.

IBM’s watsonx Code Assistant for Z will next be deployed for Red Hat Ansible Light speed. Given that was purportedly trained on more than 100 coding languages, more AI co-pilots for old mainframe code will likely follow.

Leave a Comment