This repository contains an IBM Enterprise COBOL program provided by Ross Burnett (IBM Consulting), along with its automated transpilation to six modern languages using Easy COBOL Migrator.
The exercise originated from a discussion on the IBM Community COBOL forum where Ross offered a real-world production program to test the transpiler.
MRFLCL reads a flat file of medical procedure codes (single codes and ranges like 0225U-0226U) and consolidates them into an in-memory table. Adjacent or overlapping ranges are merged. The program then reports how many records were read, how many code ranges were loaded, and how many sections were created.
This is a realistic IBM mainframe utility - it uses ++INCLUDE copybooks, IBM compiler directives (CBL cards), INDEXED BY tables with OCCURS 1000, level 88 condition names, and CALL to external subprograms.
cobol/
MRFLCL.cbl Main program (446 lines) - reads and consolidates code list
MRFXLCL.cob Caller/driver program (75 lines) - invokes MRFLCL via CALL
TBLCL.txt Shared copybook - code list table data structures
data/
ICDLIST Test input file - 25 medical procedure codes
output/
MRFLCL.py Python 3 output (644 lines)
MRFLCL.cpp C++17 output (644 lines)
MRFLCL.java Java 17 output (454 lines)
MRFLCL.cs C# 12 output (531 lines)
MRFLCL.rs Rust output (485 lines)
MRFLCL.go Go output (471 lines)
cd output
cp ../data/ICDLIST .
python MRFLCL.pyExpected output:
***** MRFLCL - LOAD CODE LIST *****
RECORDS READ: 0025
RANGES LOADED: 0017
SECTIONS LOADED: 0009
***** MRFLCL - LOAD COMPLETED *****
The program expects an input file named ICDLIST in the current working directory (matching the original JCL DD name).
Note: Only the Python output has been tested end-to-end so far. The other five language outputs have been generated but not yet compiled or tested.
The transpiler handled several IBM-specific constructs to produce working output:
++INCLUDEcopybook directive (IBM mainframe variant, not standardCOPY)CBLcompiler option cards- IBM inline label comments in copybook data sections
- Missing period on a data item in the copybook
INDEXED BYtable index variables onOCCURSarrays- Level 88 condition names with subscript support
CALLto external subprograms (generated as stubs)LINKAGE SECTIONwith group-level parameter passing
- Author: Ross Burnett, IBM Consulting (CA-MMIS)
- Program ID: MRFLCL
- Environment: IBM Enterprise COBOL for z/OS
- Purpose: Load and consolidate a code list table from a sequential file
MRFXLCL.cob is the caller/driver program that would invoke MRFLCL via CALL 'MRFLCL' USING CLA-CODE-LIST-AREA on the mainframe. For this exercise, MRFLCL was transpiled as a standalone program.
Easy COBOL Migrator is a desktop COBOL transpiler that converts COBOL source code to six modern languages: C++17, Java 17, C# 12, Python 3, Rust, and Go. It uses a full compiler pipeline (lexer, parser, semantic analyzer, code generators) - not AI or pattern matching.
A free demo is available that converts single files up to 500 lines to C++ output.
The original COBOL source code (MRFLCL.cbl, MRFXLCL.cob, TBLCL.txt) and test data (ICDLIST) are provided by Ross Burnett with permission to share publicly.
The transpiled output files were generated by Easy COBOL Migrator, developed by Mecanik Dev Ltd.