Code Generation for Z
Learn More
A recolored leadspace using the Watson for Customer Care leadspace as its basis.
Code Generation for Z

IBM watsonx Code Assistant (WCA) for Z is an AI-assisted mainframe application modernization solution that makes it easier for developers to incrementally modernize and refactor COBOL business services and selectively transform to high-quality Java code optimized for IBM Z. With watsonx Code Assistant for Z, clients will be able to leverage generative AI and automated tooling to accelerate their mainframe application modernization journey – while addressing key challenges around developer skills and time to value.


Solution Overview

IBM watsonx Code Assistant for Z is comprised of the following major components (shown in the diagram above):

  1. IBM Application Discovery and Delivery Intelligence (ADDI) scans application source code to discover and understand relationships between programs within an application system. ADDI also provides the ability to visualize and report on these dependencies as well as search the code base.


  2. The Metadata Database contains the results of the COBOL understanding and refactoring process performed by ADDI. The data in the Metadata Database is used by IBM watsonx Code Assistant to enable refactoring of large software systems comprised of multiple COBOL programs, copybooks, etc.


  3. A COBOL Source Control Management (SCM) tool provides source control for the COBOL code to be converted. The SCM repository is also associated with an ADDI project such that new COBOL services can be scanned and the metadata sent to the Metadata Database.


  4. Refactoring Assistant is a 'bridge' between ADDI and the IBM watsonx Code Assistant service. Refactoring Assistant connects to ADDI and extracts identified COBOL business services for refactoring and conversion to Java code.


  5. The IBM watsonx Code Assistant Service (WCA for Z) is an IBM application that receives prompt requests from Microsoft Visual Studio Code (VS Code) and performs matching against a Code Large Language Model (LLM). WCA for Z analyzes COBOL paragraphs and Java classes and generates code proposals that follow leading practices.


  6. Code Large Language Model (LLM) is a generative AI foundation model for code generation that is based on the IBM Granite model for Z. It may also be trained to include additional COBOL code generated by vendors or by enterprise users.


  7. COBOL Programs are standalone programs and/or components of a larger software system that may be refactored into Java services.


  8. Java Code is code that is generated by WCA for Z that replicates the behavior of the input COBOL program.

Usage and Walkthrough

The diagram above illustrates how the components of WCA for Z work together to enable developers to convert COBOL source code to Java.

  1. An architect uses the functions of ADDI to understand the COBOL Code. This product runs in a Windows VM and scans source code to provide application insights to architects. The analysis of the source code is stored in a project that an architect can access from an Eclipse-based tool. This tool enables an architect to perform different tasks, including visualizing the relationships between different programs, run reports, and search code. An architect can use this tool to start modernizing a monolithic COBOL application by identifying potential business services to refactor, with the option of converting it to Java by using generative AI.


  2. ADDI sends the results of its analysis to the Metadata Database, which in turn are added to the dataset used by IBM watsonx Code Assistant Service.


  3. The COBOL developer uses Refactoring Assistant to start extracting the COBOL business service that the architect identified from a monolith application. Refactoring Assistant is a container-based product that runs in a Linux® VM. It has a web UI for developers to visualize and select relevant code to create a new COBOL service that comprises a business function from many different existing programs. Refactoring Assistant connects to ADDI securely to access the analysis of the COBOL application in the ADDI database.


  4. After the COBOL developer selects all the code, they can export the new COBOL program to their workstation to continue developing in an integrated development environment (IDE).


  5. The refactored COBOL paragraphs are stored in the Services Repo and made available to Java developers for conversion.


  6. The Java developer uses Z Open Editor in VS Code to connect to the WCA for Z service in IBM Cloud. This service is provisioned by using an IBM Cloud account and provides access to the AI foundation model. Z Open Editor enables the Java developer to both convert and generate code as follows:

    1. First, a Java developer selects a COBOL paragraph in VS Code and sends its content to the WCA for Z service for conversion to Java class definitions.

    2. Later, in VS Code a Java developer selects individual Java classes for which the WCA for Z service should generate lines of Java code.


  7. In both cases above, the WCA for Z service uses its Code LLM to generate content. The Code LLM is a generative AI foundation model that is trained on many programming languages and is fine-tuned for converting COBOL to Java.


  8. WCA for Z sends AI-generated responses back to VS Code, and the Java developer can use leading practices for reviewing and compiling the code to complete the Java service.


  • Microsoft VS Code
  • IBM Semeru Java 17 LTS SDK
  • IBM Z Open Editor Extension for VS Code
  • Language Support for Java by Red Hat extension for VS Code
  • Account
  • Connection to IBM Watson Code Assistant
Next steps

Talk to our experts about implementing a hybrid cloud deployment pattern.

More ways to explore Hybrid Cloud Architecture Center Diagram tools and templates IBM Well-Architected Framework

Al Hamid, Mihai Criveti, Chris Kirby, Pete Nuwayser

Updated: December 5, 2023