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.