Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
dauquangthanh avatar

Cobol Migration Analyzer

  • 65 installs
  • 14 repo stars
  • Updated January 23, 2026
  • dauquangthanh/hanoi-rainbow

COBOL Migration Analyzer is an agent skill that parses COBOL programs, JCL, and copybooks to extract logic and dependencies so teams can plan Java implementations and migration reports.

About

COBOL Migration Analyzer is a Hanoi Rainbow skill for analyzing legacy COBOL programs, JCL jobs, and copybooks to support modernization to Java. Use it when planning or executing mainframe migration, extracting business logic, estimating complexity, or generating Java POJO sketches from copybook layouts. It shines on brownfield codebases with .cbl, .jcl, and .cpy assets rather than greenfield API design from scratch.

  • COBOL division and paragraph extraction
  • JCL and copybook dependency graphs
  • COBOL-to-Java type mapping including COMP-3
  • Bundled scripts for structure and complexity estimates

Cobol Migration Analyzer by the numbers

  • 65 all-time installs (skills.sh)
  • Ranked #3,110 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
  • Data as of Jul 29, 2026 (Skillselion catalog sync)
npx skills add https://github.com/dauquangthanh/hanoi-rainbow --skill cobol-migration-analyzer

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs65
repo stars14
Last updatedJanuary 23, 2026
Repositorydauquangthanh/hanoi-rainbow

How do you understand COBOL business logic, JCL workflows, and copybook data layouts well enough to design a safe Java replacement?

Parses COBOL, JCL, and copybooks to map dependencies and draft Java migration strategies and POJOs.

Who is it for?

Developers modernizing mainframe workloads who need dependency maps, structure extraction, and Java-oriented migration estimates.

Skip if: Projects with no COBOL or JCL assets, or teams only building greenfield Java without legacy analysis.

When should I use this skill?

You are analyzing .cbl/.cob programs, JCL jobs, or copybooks for a COBOL-to-Java or legacy modernization effort.

What you get

Migration reports with dependency graphs, extracted structures, Java class sketches, and complexity estimates emerge from the analysis workflow.

Files

SKILL.mdMarkdownGitHub ↗

COBOL Migration Analyzer

Analyze legacy COBOL programs and JCL scripts for migration to Java. Extract business logic, data structures, and dependencies to generate actionable migration strategies.

Core Capabilities

1. COBOL Program Analysis

Extract COBOL divisions (IDENTIFICATION, ENVIRONMENT, DATA, PROCEDURE), Working-Storage variables, file definitions (FD), business logic paragraphs, PERFORM statements, CALL hierarchies, embedded SQL, and error handling patterns.

2. JCL Job Analysis

Parse JCL job steps, program invocations, data dependencies (DD statements), conditional logic (COND, IF/THEN/ELSE), return codes, and resource requirements.

3. Copybook Processing

Extract record layouts with level numbers, REDEFINES clauses, group items, OCCURS clauses, and picture clauses. Generate Java POJOs from copybook structures.

4. Dependency Mapping

Build complete dependency graphs showing CALL hierarchies, copybook usage, file dependencies, database table access, and shared utility references across the codebase.

Workflow

Step 1: Discover COBOL Assets

Find COBOL programs, JCL jobs, and copybooks:

find . -name "*.cbl" -o -name "*.CBL" -o -name "*.cob"
find . -name "*.jcl" -o -name "*.JCL"
find . -name "*.cpy" -o -name "*.CPY"

Use scripts/analyze-dependencies.sh or scripts/analyze-dependencies.ps1 to generate dependency graph.

Step 2: Extract Structure

Use scripts/extract-structure.py to parse COBOL programs and extract divisions, variables, paragraphs, and dependencies in JSON format.

Step 3: Generate Java Code

Use scripts/generate-java-classes.py to convert copybooks to Java POJOs with appropriate data types and Bean Validation annotations.

Step 4: Estimate Complexity

Use scripts/estimate-complexity.py to calculate migration complexity based on LOC, external calls, file operations, SQL statements, and control flow.

Step 5: Create Migration Strategy

Document program overview, dependencies, data structures, business logic patterns, proposed Java design, migration estimate, and action items.

Quick Reference

COBOL to Java Type Mapping

COBOL PictureJava TypeNotes
PIC 9(n)int, long, BigIntegerUnsigned numeric
PIC S9(n)int, long, BigIntegerSigned numeric
PIC 9(n)V9(m)BigDecimalUnsigned decimal
PIC S9(n)V9(m)BigDecimalSigned decimal
PIC S9(n)V9(m) COMP-3BigDecimalPacked decimal - critical precision!
PIC S9(n) COMP / BINARYint, longBinary storage
PIC S9(n) COMP-1floatSingle precision (avoid for financial)
PIC S9(n) COMP-2doubleDouble precision (avoid for financial)
PIC X(n)StringAlphanumeric/character
PIC A(n)StringAlphabetic only
PIC N(n)StringNational/Unicode
OCCURS nList<T> or T[]Fixed arrays/tables
OCCURS n DEPENDING ONList<T>Variable-length arrays
88 levelenum or constantsCondition names
INDEXintTable index (1-based in COBOL)

Common Pattern Conversions

  • File I/O: READ...AT ENDBufferedReader with try-with-resources or NIO streams
  • File updates: REWRITE → Update operations in DB or file systems
  • Table lookup: SEARCH → Linear search with streams
  • Binary search: SEARCH ALLCollections.binarySearch() or stream().filter().findFirst()
  • String operations: STRING/UNSTRINGStringBuilder or String.split()
  • Inspection: INSPECTString.replace(), replaceAll(), or regex
  • CALL statements: → Method calls or service invocations
  • EVALUATE: → switch statement (Java 14+ with enhanced switch)
  • Date arithmetic: FUNCTION INTEGER-OF-DATELocalDate operations
  • ACCEPT DATE/TIME: → LocalDate.now(), LocalTime.now()
  • Condition names (Level 88): → enum or typed constants
  • Computed GO TO: → Strategy pattern or switch statement
  • REDEFINES: → Union types, ByteBuffer views, or separate accessor classes
  • COPY statements: → Package imports or shared entity classes

Example: Copybook to Java POJO

COBOL Copybook:

01  EMPLOYEE-RECORD.
    05  EMP-ID        PIC 9(6).
    05  EMP-NAME      PIC X(30).
    05  EMP-SALARY    PIC S9(7)V99 COMP-3.

Generated Java:

public class EmployeeRecord {
    private int empId;
    private String empName;
    private BigDecimal empSalary;
    // getters/setters
}

Migration Considerations

Critical Patterns:

1. ALWAYS use BigDecimal for COMP-3 and numeric with decimals (never float/double) 2. Preserve precision: Use BigDecimal with exact scale for financial calculations 3. 1-based indexing: Document that COBOL arrays start at 1, Java at 0 4. Implicit conversions: Make COBOL's automatic numeric↔string conversions explicit 5. REDEFINES: Model as union type, ByteBuffer overlay, or separate view classes 6. Computed GO TO: Refactor to strategy pattern or switch statement 7. ALTER statement: Refactor to structured control flow (if/while/switch) 8. PERFORM THRU: Map to single method containing full paragraph range 9. BY REFERENCE vs BY CONTENT: Document parameter passing semantics 10. Test rigorously: Validate with production data samples, especially for COMP-3

Output Requirements:

  • Program overview and type classification
  • Complete dependency graph (CALL tree, copybooks, files, DB tables)
  • Data structure mapping (copybooks → Java classes)
  • Business logic summary (key paragraphs → methods)
  • Proposed Java architecture (services, repositories, entities)
  • Migration effort estimate (complexity score, LOC, risk factors)
  • Prioritized action items

Advanced Topics

For detailed conversion rules and patterns, see:

  • [pseudocode-cobol-rules.md](references/pseudocode-cobol-rules.md) - Comprehensive COBOL to pseudocode conversion rules including data types, statements, file operations, string operations, table operations, program control, translation patterns, and common gotchas
  • [pseudocode-common-rules.md](references/pseudocode-common-rules.md) - Common pseudocode syntax and conventions applicable to all languages
  • [transaction-handling.md](references/transaction-handling.md) - Transaction management and rollback strategies for CICS/IMS to Java
  • [messaging-integration.md](references/messaging-integration.md) - Message queue and async patterns (MQ, CICS queues to JMS/Kafka)
  • [performance-patterns.md](references/performance-patterns.md) - Batch processing optimization and memory management
  • [testing-strategy.md](references/testing-strategy.md) - Comprehensive testing including unit, integration, parallel validation, and data-driven testing

Tools and Scripts

All scripts support cross-platform execution (Windows PowerShell, bash):

  • analyze-dependencies.sh/ps1 - Generate dependency graph
  • extract-structure.py - Parse COBOL structure to JSON
  • generate-java-classes.py - Convert copybooks to Java POJOs
  • estimate-complexity.py - Calculate migration complexity score

Scripts use standard libraries only and output JSON for easy integration with CI/CD pipelines.

Related skills

FAQ

Does it automatically rewrite all COBOL to Java?

It guides analysis and can generate POJO sketches; full translation still requires engineering judgment and testing.

Which file types does it target?

COBOL sources (.cbl, .CBL, .cob), JCL (.jcl), and copybooks (.cpy, .CPY) per the skill workflow.

Are helper scripts included?

Yes—dependency analysis, structure extraction, Java generation, and complexity estimation scripts are referenced in the skill.

Backend & APIsbackendintegrations

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.