Skip to content

πŸš€ CodeMigrate is a COBOL-to-Python converter designed to help modernize legacy enterprise applications. Built with Python, it supports COBOL structure parsing, file I/O migration, and output-ready Python scripts.

License

Notifications You must be signed in to change notification settings

Shristirajpoot/CodeMigrate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ› οΈ CodeMigrate – Modernize COBOL in a Click! 🐍✨

A lightning-fast COBOL ➜ Python converter built with ❀️ in pure Python.

GitHub Repo stars GitHub last commit Built with


🌟 Overview

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.


🎨 Features

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

πŸ“‚ Project Structure

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

πŸš€ Getting Started

πŸ“¦ Prerequisites

Python 3.7 +

πŸ”§ Installation

git clone https://github.com/Shristirajpoot/CodeMigrate.git
cd CodeMigrate

(No extra packages required.)

▢️ Convert a File

python cobol_converter.py payroll_system.cob payroll_system.py

▢️ Run the Generated Script

python payroll_system.py

Ensure employees.dat is in the same directory.

πŸ”’ Input Data Layout (employees.dat)

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

Output Example

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.


πŸ“ˆ Roadmap / Future Enhancements

  • πŸš€ Support additional COBOL constructs (PERFORM, EVALUATE, etc.)

  • πŸ§ͺ Add unit-test scaffolding for generated code

  • πŸ›‘οΈ Improve error handling & logging

🀝 Contributing

  1. Fork the repo πŸ‘†

  2. git checkout -b feature/awesome

  3. Commit & push, then open a PR!

πŸ‘©β€πŸ’» Author

Shristi Rajpoot

πŸ“„ License

CodeMigrate is released under the MIT License.

⭐ If this project saved you hours of manual migration, please star it and share!

About

πŸš€ CodeMigrate is a COBOL-to-Python converter designed to help modernize legacy enterprise applications. Built with Python, it supports COBOL structure parsing, file I/O migration, and output-ready Python scripts.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •