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.pypython payroll_system.pyEnsure 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.