Languages / COBOL
COBOL code analysis: map, document and modernize a mainframe codebase
To understand a COBOL codebase whose authors are gone, start with a map: which JCL runs which program, which program CALLs or LINKs to which, which copybooks each one copies and which BMS maps it sends. repowise builds that map from source, writes a documentation page per program, adds git history, and runs fully offline on your own machines.
Last reviewed: November 2026
Good tier
What repowise detects in COBOL
Checked against the engine source. Every row runs locally with zero LLM calls.
| Files parsed | .cbl, .cob, .cobol, .cpy copybooks, .dcl DB2 DCLGEN members, JCL (.jcl, .prc, .proc), BMS (.bms), CICS CSD (.csd) |
|---|---|
| Import resolution | Full. COPY and EXEC SQL INCLUDE resolve to the nearest copybook of that name; system copybooks such as DFHAID stay external |
| Call graph | CALL, PERFORM, CICS LINK and XCTL to literal or constant-moved targets; PERFORM binds within a program and its copybooks |
| Dead code | Programs and files are exempt; one claim for unreached paragraphs at confidence 0.3, shown with --min-confidence 0.3 |
| Health markers | Each paragraph and section is a function: IF, WHEN, PERFORM UNTIL and VARYING, AND and OR add complexity; advisory unstructured-flow marker |
| Performance markers | None |
| Coverage reports | No COBOL-specific format; generic lcov, Cobertura or repowise JSON reports are read |
| Frameworks recognised | JCL EXEC PGM and EXEC PROC, CICS CSD DEFINE PROGRAM and TRANSACTION, CICS SEND and RECEIVE MAP to BMS, RETURN and START TRANSID to programs |
Specific to this language
How COBOL code is read
What gets linked
JCL EXEC PGM=X links the step to the program and makes the program an entry point; EXEC PROC links to the procedure member. CSD DEFINE PROGRAM and TRANSACTION link to the program. CICS SEND and RECEIVE MAP with MAPSET link to the BMS source. RETURN TRANSID and START TRANSID link to the program that runs that transaction when every definition agrees. CICS LINK and XCTL to a literal, or to a constant moved into a field, link to the target program; anything else is recorded as a dynamic target, not guessed.
Documentation for code nobody remembers
repowise init --no-prose renders a page per program and copybook from the parsed structure with no model and no key: paragraphs, calls, callers, copybooks, the JCL that runs it, owners and change history. repowise generate adds written explanations with any LLM you configure, including a local Ollama model, and prices the run before it starts.
Self-hosted and air-gapped
All analysis makes zero LLM calls and needs no network. The COBOL grammar downloads on first use; for an air-gapped machine, run repowise grammars fetch <dir> on a connected machine, copy the directory across and set REPOWISE_GRAMMAR_DIR. Enterprise adds on-prem deployment, SSO, RBAC and audit.
Planning a modernization
A migration plan starts with blast radius and order: which programs are entry points (JCL steps, CICS transactions), which are shared by many callers, which copybooks are copied everywhere, and which programs change together in history. repowise gives each of these as a graph query or an MCP answer, so a person or an agent can sequence the work before code is rewritten.
Honest comparison
Native COBOL tools, and when they are enough
| Tool | What it covers |
|---|---|
| Compiler listings (XREF, MAP) | Cross-reference of data names and paragraphs per program, from the IBM or Micro Focus compiler. |
| IBM Application Discovery and Delivery Intelligence (ADDI) | IBM's mainframe application analysis: inventories, call and data-flow views, impact analysis. |
| OpenText (formerly Micro Focus) Enterprise Analyzer | Mainframe portfolio analysis, inventories and impact analysis. |
| SonarQube COBOL analyzer | Rule-based COBOL code quality checks in commercial editions. |
Where repowise adds value
- Works on the source in a git repository, on a laptop or a server, with no mainframe connection.
- Git history on COBOL: hotspots, ownership, bus factor and co-change, which show who still knows each program.
- Documentation pages per program, and an MCP server so Claude Code, Codex or Cursor can answer questions about the estate with citations.
- The Java or C# services that replace COBOL programs sit in the same graph during a migration.
How to run it
Analyse a COBOL repository
From the repository root. Agents get the same results through the get_dead_code, get_health and get_context MCP tools.
uv tool install repowise # or: pipx install repowise
repowise init --yes --no-prose # index the repo, no API key
repowise dead-code --min-confidence 0.7 --safe-only
repowise health --refactoring-targets
repowise serve # graph, health and dead code in a local dashboardQuestions
What people ask before they try it.
How do I understand an old COBOL codebase without the original developers?
Get the source into a git repository (programs, copybooks, JCL, BMS and CSD), run repowise init --yes --no-prose, and open repowise serve. You get which JCL runs which program, the CALL, LINK and XCTL graph, copybook usage, a generated page per program, and git history showing who changed what. An agent connected over MCP can then answer questions such as which programs copy a given copybook, with file and line citations.
How do I plan a mainframe COBOL modernization?
Start from the dependency map: entry points (JCL steps and CICS transactions), shared programs with many callers, widely copied copybooks, and programs that change together. Those set the migration order and the blast radius of each step. repowise provides each as a graph view or an MCP query, and keeps the new Java or C# code in the same graph as it lands.
Can repowise find dead COBOL code?
Yes, at paragraph level. Programs and files are protected, because JCL, CSD and dynamic calls can reach them. repowise reports a paragraph whose name appears nowhere else, which follows an unconditional end such as GOBACK or STOP RUN, in a single-program file with no REPLACE or COPY REPLACING. Show them with repowise dead-code --min-confidence 0.3.
Does it run air-gapped?
Yes. Analysis needs no network and no LLM. Stage the COBOL grammar with repowise grammars fetch on a connected machine and set REPOWISE_GRAMMAR_DIR on the offline one. Written prose, if you want it, can come from a local Ollama model.
Does it support fixed and free format?
Fixed reference format is the default, and free-format source (>>SOURCE FORMAT FREE or Micro Focus SOURCEFORMAT"FREE") is normalised into fixed columns before parsing. COPY, EXEC SQL, EXEC CICS and EXEC DLI blocks are masked so paragraphs are not lost.
Related reading
Index a COBOL repository.
Public repositories are free on repowise.dev. The CLI is open source and runs on your machine with no API key.