A lightning-fast COBOL β Python converter built with β€οΈ in pure Python.
CodeMigrate is a utility that translates legacy COBOL programs into clean, ready-to-run Python.
Ideal for teams moving main-frame logic to modern stacks without losing decades of business rules.
- β‘ Automatic Translation Β βΒ WORKING-STORAGE β Python classes, PROCEDURE DIVISION β functions
- π File Parsing Β βΒ Converts COBOL file I/O to Python file handling
- π Regex-Driven Rules Β βΒ Easily extend patterns for custom COBOL syntax
- π Human-Readable Output Β βΒ Well-structured, commented Python code
CodeMigrate/
βββ cobol_converter.py # Main converter script
βββ payroll_system.cob # Sample COBOL program
βββ employees.dat # Sample data file
βββ payroll_system.py # Generated sample output
βββ README.md # This file
βββ LICENSE # MIT
Python 3.7 +
git clone https://github.com/Shristirajpoot/CodeMigrate.git
cd CodeMigrate
(No extra packages required.)
python cobol_converter.py payroll_system.cob payroll_system.py
python payroll_system.py
Ensure employees.dat is in the same directory.
Field | Length | Offset |
---|---|---|
Employee ID | 5 | 0β4 |
Employee Name | 20 | 6β25 |
Department | 19 | 27β45 |
Salary | 8 | 47β54 |
Tax Rate | 5 | 56β60 |
COBOL Snippet
IDENTIFICATION DIVISION.
PROGRAM-ID. PAYROLL-SYSTEM.
...
Auto-generated Python
import decimal
class PAYROLL_SYSTEM:
class EMPLOYEERecord:
def __init__(self):
self.emp_id = 0
self.emp_name = ""
self.emp_department = ""
self.emp_salary = 0.0
self.emp_tax_rate = 0.0
def __init__(self):
self.employee_file_path = 'employees.dat'
...
Ensure the input data file (employees.dat
) exists in the same directory as the script.
-
π Support additional COBOL constructs (PERFORM, EVALUATE, etc.)
-
π§ͺ Add unit-test scaffolding for generated code
-
π‘οΈ Improve error handling & logging
-
Fork the repo π‘
-
git checkout -b feature/awesome
-
Commit & push, then open a PR!
- π§ shristirajpoot369@gmail.com
- π @Shristirajpoot
CodeMigrate is released under the MIT License.