Mainframe modernization in banking, insurance, and the public sector faces a persistent, multi-billion-dollar dilemma: core transaction engines run on millions of lines of monolithic COBOL, undocumented after four decades of continuous patches, while the engineers who wrote the original code have retired. Attempting a direct "blind rewrite" or feeding raw COBOL batches into generic cloud large language models (LLMs) regularly triggers severe regressions. Generic models fail to grasp z/OS sub-systems, hallucinate packed-decimal arithmetic, and miss cross-program data side effects.
Mainframe modernization teams resolve this challenge through IBM watsonx Code Assistant for Z, specifically its Z Understand foundation. By combining deterministic static code analysis with mainframe-specialized IBM Granite foundation models and agentic workflows, the platform transforms opaque legacy monoliths into fully mapped dependency graphs and human-readable, auditable business rule catalogs.
The Modernization Challenge: The Monolithic COBOL Black Box
Core banking systems and claims engines rarely consist of cleanly separated components. Instead, an architect typically encounters:
- Tightly Coupled Call Hierarchies: Deeply nested static
CALLstatements, dynamic subprogram invocations, and CICSLINK/XCTLcontrol transfers across hundreds of load modules. - Shared Memory and Overlaid Storage: Extensive use of
COPYstatements (copybooks) andREDEFINESclauses, where the same memory block represents different data structures depending on transaction state. - Entangled Data Access: Interleaved SQL queries against Db2, native VSAM key-sequenced data set (KSDS) reads, and sequential tape file writes inside the same procedural paragraph.
- Undocumented Business Logic: Critical regulatory calculations, rate formulas, and customer routing rules buried within labyrinthine
IF...ELSE,EVALUATE, andGO TOloops, with zero updated technical documentation.
Modernizing this environment requires a strict rule: you cannot safely refactor or rewrite what you cannot trace. IBM watsonx Code Assistant addresses this not by jumping immediately to code generation, but by enforcing a rigorous "Understand" phase.
Architectural Foundation: How Z Understand Works
IBM watsonx Code Assistant for Z structures its modernization pipeline into four distinct phases: Understand, Refactor, Transform, and Validate.
The Understand stage merges two complementary technologies:
- Deterministic Static Analysis (derived from Application Discovery): Parses COBOL programs, copybooks, JCL job steps, CICS CSD tables, and Db2 schemas into a centralized graph database repository. This guarantees 100% mathematical precision for structural relationships without LLM hallucinations.
- Mainframe-Tuned Generative and Agentic AI: Deploys IBM Granite models trained specifically on enterprise mainframe languages (COBOL, PL/I, Assembler, JCL, Java). Operating through Model Context Protocol (MCP) toolsets in Visual Studio Code and a web workspace, AI agents analyze the parsed ASTs (Abstract Syntax Trees) and control-flow slices to explain semantic intent in natural language.
+--------------------------------------------------------------------------+
| Z Understand Ingestion Layer |
| COBOL Sources | Shared Copybooks | JCL Streams | Db2 / VSAM DDL |
+--------------------------------------------------------------------------+
|
v
+--------------------------------------------------------------------------+
| Deterministic Application Discovery Graph Engine |
| - Program Call Hierarchies (Static, Dynamic, CICS LINK/XCTL) |
| - Data Flow & Shared Memory Lineage (REDEFINES, COPY) |
| - Database Access Paths & JCL Batch Step Dependencies |
+--------------------------------------------------------------------------+
|
v
+--------------------------------------------------------------------------+
| Z Understand Visual Workspace & VS Code Extension |
| - Interactive Call Graphs & Topological Closure Maps |
| - Identify Business Variables Engine (AI-Ranked Candidates) |
+--------------------------------------------------------------------------+
|
v
+--------------------------------------------------------------------------+
| Generative Business Rule Discovery (Granite LLM) |
| - Backward Program Slicing around Core State Variables |
| - Natural-Language Rule Synthesis (Condition -> Action -> Impact) |
| - Project Data Dictionary Population & Export (JSON / CSV) |
+--------------------------------------------------------------------------+
Step 1: Mapping Program Call Hierarchies and Data Flow Dependencies
Before extracting individual rules, architects must define the application perimeter. In IBM watsonx Code Assistant for Z, teams execute dependency mapping across three levels:
1. Generating Program Closure Graphs
Within the Visual Studio Code extension (from the PROJECT ARTIFACTS view) or the Z Understand Web UI, engineers select a root program (such as an online CICS transaction driver or a nightly batch posting routine) and generate a Closure Graph:
- Forward Call Trees: Visually traces every subprogram called, downstream utilities invoked, and external database systems queried.
- Backward Dependency Tracing: Identifies every upstream batch job step or interface module capable of invoking the current program.
- Boundary Scoping: Engineers can quickly spot dead code branches that are never reached, as well as highly coupled subroutines that must be refactored together.
2. Tracing Data Lineage and Copybook Sharing
Mainframe bugs during migration usually arise from shared working storage. Z Understand maps how data flows across module boundaries:
- It tracks which programs read or modify specific Db2 columns or VSAM record buffers.
- It clarifies copybook usage, exposing which submodules share common
COMM-AREAstructures and flagging dangerous field overlays created viaREDEFINES.
| Dependency Dimension | Technical Mechanism in IBM watsonx Code Assistant | Modernization Value |
|---|---|---|
| Control Flow | Automated static call graph generation; CICS command parsing (LINK, XCTL) | Isolates microservice and service-oriented boundaries; eliminates dead code |
| Data Lineage | Variable tracing across PROCEDURE DIVISION and shared copybooks | Exposes field mutations; prevents side-effect regressions during refactoring |
| Storage Overlays | Structural AST analysis of REDEFINES and OCCURS clauses | Prevents data corruption during COBOL-to-Java type conversion |
| Batch Orchestration | JCL dataset step correlation and file dependency mapping | Maps execution order and batch window concurrency constraints |
Step 2: Extracting Undocumented Business Rules (BRD Workflow)
Once dependencies are bounded, teams turn to Business Rule Discovery (BRD). In enterprise COBOL, technical statements (file status validation, string padding, screen formatting) outnumber core business logic by ten to one. watsonx Code Assistant isolates high-value rules through a structured, multi-step workflow.
Phase 1: Interactive Conversation & Business Function Scoping
Using the conversational agent in the Z Understand Web UI or VS Code, engineers initiate business rule discovery by referencing a business process (such as "loan interest amortization" or "penalty fee calculation"). The AI agent cross-references the repository to shortlist the candidate COBOL programs implementing that function.
Phase 2: Identifying and Ranking Business Variables
Within the selected program node on the Call Graph, developers trigger the "Identify business variables" action:
- The static analysis engine scans variable references across conditions, calculations, and assignments.
- It filters out technical operational flags (such as loop indices, return codes like
WS-RETURN-CODE, file status bytes, and terminal display fields). - The system presents an Identify Business Variables Table, ranking data elements by their probability of driving operational decisions.
- AI models generate initial plain-language labels and semantic tags (e.g., mapping
CUST-RSK-RTG-CDtoCustomer Risk Rating Code).
Phase 3: Backward Program Slicing
When an engineer selects a prioritized variable, watsonx Code Assistant performs program slicing:
- It opens a read-only code viewer displaying only the lines of code that directly compute, mutate, or condition the chosen variable.
- It collapses hundreds of lines of unrelated boilerplate I/O, allowing developers to see the exact decision tree (e.g., nested
EVALUATEblocks determining customer tiering).
Phase 4: Natural-Language Rule Synthesis
For the isolated slice, the Granite foundation model synthesizes a formal business rule statement:
- Condition: "If account balance is below minimum threshold AND account age is greater than 180 days..."
- Action: "...deduct monthly maintenance fee of $15.00 and set delinquency flag to active."
- Traceability: The generated rule retains bidirectional source hyperlinks directly to the starting and ending COBOL line numbers.
Phase 5: Curation, Data Dictionary Population, and Export
Engineers review the AI-synthesized rule, edit any business terminology to conform to enterprise policy, and click Create:
- The variable and approved definitions are automatically stored in the project's centralized Data Dictionary.
- Teams export the finalized business rules as structured
.jsonor.csvfiles. - These exported rule catalogs serve as the blueprint for business analysts, documentation teams, and downstream service refactoring.
365Finds Institutional Judgment: Where watsonx Wins and Where Caution Is Required
At 365Finds, our evaluation of enterprise AI tooling prioritizes production safety, deterministic accuracy, and total cost of delivery over raw novelty. For mainframe modernization programs, our judgment is definitive:
Why 365Finds Recommends IBM watsonx Code Assistant for Z
- Static Analysis Anchoring Prevents AI Hallucination: Relying on generic LLM prompts to reverse-engineer COBOL is irresponsible. Mainframe code contains subtle syntax quirks—such as implicit scope terminators,
PERFORM THROUGHranges, and binary arithmetic truncation—that generic models misinterpret. watsonx anchors its LLM reasoning in deterministic static analysis from Application Discovery, ensuring the dependency graph is mathematically complete. - Context-Aware Variable Ranking Cuts Labor by 70%: Sifting through 30,000-line monolithic programs to locate decision logic accounts for the vast majority of engineering hours in legacy projects. watsonx's automated ranking of business variables versus technical flags reliably cuts rule discovery timelines from months to days.
- Seamless Transition to Modular Transformation: Extracted rules do not end up stranded in static PDFs. They feed directly into watsonx Code Assistant's subsequent refactoring and Java transformation modules, accompanied by auto-generated JUnit test suites verifying semantic equivalence.
Operational Caveats and Guardrails
- Dynamic Program Calls Require Manual Annotation: When COBOL programs call submodules dynamically via variables (
CALL WS-PGM-NAME), static analysis cannot always determine the target module without execution log data. Architects must review dynamic call lists and provide resolution hints. - Enforce the 80/20 SME Review Discipline: 365Finds strongly advises against unverified automated migration. Organizations should let watsonx Code Assistant perform 80% of the extraction and documentation work, while assigning senior mainframe domain specialists to review the 20% highest-risk financial calculations before committing to Java refactoring.
By deploying IBM watsonx Code Assistant for Z's Understand toolset, modernization teams transform an unpredictable legacy code base into an engineered, transparent application blueprint—enabling legacy core renewal without jeopardizing daily transaction stability.
References
- AI Coding Agent and Development Partner for Enterprise | IBM
- IBM watsonx Code Assistant for Z
- IBM watsonx Code Assistant for Z IBM watsonx Code Assistant for Z | IBM Documentation
- Agentic AI for smarter mainframe modernization with IBM watsonx Code Assistant for Z
- National Organization for Social Insurance (NOSI) Case Study | IBM