Skip to content

tsiitz/kicks-to-python

Repository files navigation

KICKS/COBOL to Python Conversion

Modernizing Legacy Mainframe Applications

License: MIT Python 3.8+ Flask

A complete, working example of converting CICS/COBOL applications to modern Python web applications

This repository demonstrates the full conversion of Doug Lowe's classic CICS sample application suite from KICKS/COBOL running on MVS 3.8J to a modern Python Flask web application with SQLite database.

πŸ“š View Documentation Site


🎯 What's This Project?

This is a complete, runnable conversion showing how to modernize legacy mainframe applications:

  • Original: CICS/COBOL programs + BMS maps + VSAM files (MVS 3.8J)
  • Converted: Python/Flask web app + HTML templates + SQLite database
  • Plus: Original COBOL source code for comparison

Customer Inquiry Screenshot

Why This Matters

Thousands of enterprises still run critical business applications on mainframes with CICS/COBOL. This project provides:

βœ… Real working code (not just theory)
βœ… Complete conversion patterns
βœ… Both original COBOL and converted Python
βœ… Side-by-side comparison of architectures
βœ… Production-ready starting point


πŸš€ Quick Start

Run the Python Application

# Clone the repository
git clone https://github.com/tsiitz/kicks-to-python.git
cd kicks-to-python

# Install dependencies
pip install -r requirements.txt

# Run the application
python app.py

# Open browser to http://localhost:5000

That's it! The application automatically:

  • Creates the SQLite database
  • Loads sample data (7 customers, 5 products, 4 invoices)
  • Starts the Flask web server

Sample Data:

  • Customer Numbers: 400001, 400002, 400003, 400004, 400005, 400006, 400007
  • Product Codes: 0000000001, 0000000005, 0000000010, 0000000020, 0000000025

πŸ“¦ What's Included

Python Web Application

File Description
app.py Flask web application with all routes (CICS transactions)
models.py Data models - COBOL records β†’ Python dataclasses
database.py Database layer - VSAM operations β†’ SQL queries
templates/ HTML templates - BMS maps β†’ Jinja2 with 3270 styling
requirements.txt Python dependencies

Converted Transactions:

  • INQ1 - Customer inquiry
  • INQ2 - Customer inquiry with browse (PF5/6/7/8)
  • INQ3 - Customer inquiry with invoices
  • MNT1 - Customer maintenance (Add/Change/Delete)
  • MENU - Application menu
  • LIST - Customer list report

COBOL Source Code (/cobol-source/)

Program Lines Description
CUSTINQ1.cbl 170 Basic customer inquiry
CUSTINQ2.cbl 380 Customer inquiry with file browse
CUSTMNT1.cbl 430 Customer maintenance
INVMENU.cbl 120 Application menu

Plus BMS map definitions and comprehensive documentation.

Documentation


πŸ”‘ Key Conversion Patterns

VSAM File β†’ SQL Table

COBOL:

EXEC CICS READ FILE('CUSTMAS')
     INTO(CUSTOMER-MASTER-RECORD)
     RIDFLD(CM-CUSTOMER-NUMBER)
END-EXEC

Python:

customer = customer_repo.find_by_number(customer_number)

File Browse β†’ SQL Pagination

COBOL:

EXEC CICS STARTBR FILE('CUSTMAS') RIDFLD(KEY) GTEQ END-EXEC
EXEC CICS READNEXT FILE('CUSTMAS') INTO(RECORD) END-EXEC

Python:

customer = customer_repo.get_first()  # PF5
customer = customer_repo.get_next(current_number)  # PF8

Pseudo-Conversational β†’ Flask Sessions

COBOL:

EXEC CICS RETURN TRANSID('INQ1') COMMAREA(COMMUNICATION-AREA) END-EXEC

Python:

session['mnt_customer_number'] = customer_number
return redirect(url_for('customer_detail'))

🎨 Features

  • βœ… Authentic 3270 terminal styling (green-on-black)
  • βœ… PF key simulation (F3, F5-F8, F12)
  • βœ… Complete database layer with repository pattern
  • βœ… VSAM browse operations β†’ SQL pagination
  • βœ… Pseudo-conversational design β†’ Flask sessions
  • βœ… BMS maps β†’ HTML templates with Jinja2
  • βœ… Error handling and validation
  • βœ… Sample data included

πŸ—„οΈ Database Schema

customers (VSAM CUSTMAS)

Column Type Description
customer_number INTEGER PRIMARY KEY 6-digit customer number
first_name VARCHAR(20) Customer first name
last_name VARCHAR(30) Customer last name
address VARCHAR(30) Street address
city VARCHAR(20) City
state CHAR(2) State code
zip_code VARCHAR(10) ZIP code

products, invoices, invoice_items

Complete schema for all VSAM files converted to SQL tables.


πŸ› οΈ Technology Stack

Python Application:

  • Flask 3.0 - Web framework
  • SQLite 3 - Database
  • Jinja2 - Templates
  • Python 3.8+

Original COBOL:

  • MVS 3.8J TK4 - Operating system
  • KICKS - CICS replacement
  • COBOL (ANSI) - Programming language
  • VSAM KSDS - File system

πŸ“š Documentation

This repository includes extensive documentation:

  1. README.md - This file - Quick start and overview
  2. KICKS_TO_PYTHON_CONVERSION_GUIDE.md - Comprehensive 60+ page conversion guide
  3. cobol-source/README.md - COBOL program documentation
  4. GitHub Pages Site - Beautiful documentation website

What's in the Conversion Guide

  • Application overview and architecture decisions
  • Data migration strategies (VSAM β†’ SQL)
  • Program conversion patterns (COBOL β†’ Python)
  • BMS map conversion (3270 β†’ HTML)
  • Implementation roadmap (16-week plan)
  • Complete code examples for every pattern

🎯 Use Cases

Learning

  • Study authentic CICS programming patterns
  • Understand mainframe β†’ web conversion
  • Learn Flask/Python with real-world example
  • See VSAM β†’ SQL migration in action

Reference

  • Template for your own conversion projects
  • Copy proven conversion patterns
  • Model architecture after this example

Teaching

  • Mainframe programming courses
  • Web development with legacy integration
  • Database migration techniques

πŸ“Έ Screenshots

Customer Inquiry (INQ1)

Customer Inquiry

Customer List

Customer List

Customer Maintenance

Customer Maintenance


🀝 Contributing

Contributions welcome! Please feel free to:

  • Report bugs via GitHub issues
  • Submit pull requests with enhancements
  • Improve documentation
  • Add more program conversions

πŸ“„ License

MIT License - See LICENSE file for details.

Attribution:

  • Original COBOL programs based on examples from "CICS for the COBOL Programmer" by Doug Lowe (Murach & Associates)
  • KICKS by moshix - https://github.com/moshix/kicks

πŸ™ Credits

  • Doug Lowe - Original CICS sample applications
  • Mike Murach & Associates - Publisher of "CICS for the COBOL Programmer"
  • moshix - KICKS for TSO/MVS
  • IBM - CICS, COBOL, MVS technologies

🌟 Star This Repo

If you find this project useful, please give it a star! ⭐

It helps others discover this resource for mainframe modernization.


Made with ❀️ for the mainframe modernization community

View Documentation β€’ Report Bug β€’ Request Feature

About

Conversion of CICS[KICKS]/COBOL Application to Python Flask

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors