Skip to content

Mecanik-Dev/MRFLCL-Exercise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MRFLCL - IBM COBOL Code List Loader (Transpilation Exercise)

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.

What the program does

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.

Repository structure

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)

Running the Python output

cd output
cp ../data/ICDLIST .
python MRFLCL.py

Expected 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.

IBM mainframe constructs handled

The transpiler handled several IBM-specific constructs to produce working output:

  • ++INCLUDE copybook directive (IBM mainframe variant, not standard COPY)
  • CBL compiler option cards
  • IBM inline label comments in copybook data sections
  • Missing period on a data item in the copybook
  • INDEXED BY table index variables on OCCURS arrays
  • Level 88 condition names with subscript support
  • CALL to external subprograms (generated as stubs)
  • LINKAGE SECTION with group-level parameter passing

About the original COBOL

  • 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.

About Easy COBOL Migrator

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.

License

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors