COBOL Payment System
A command-line batch processor that reconciles payment transactions against a master account ledger, validates business rules, and produces audit-ready reports.
View source on GitHub โ01. What it does
The program loads accounts from a sequential file, reads a list of transactions, and validates each one. Approved debits and credits update balances in memory; at the end the program writes the updated ledger, an approved list, a rejected list with reason codes, and a summary report.
02. Features
- Loads accounts into an in-memory table for fast lookups
- Reads transactions from a plain-text CSV-style file
- Rejects unknown accounts
- Rejects invalid transaction types (only DEBIT/CREDIT allowed)
- Prevents overdraft debits with balance checks
- Writes approved transactions with the new balance
- Persists the updated account ledger to a new file
- Generates a summary report of total, approved, and rejected
03. Sample input
ACCOUNTS.TXT
000001,1000 000002,300 000003,50
TRANSACTIONS.TXT
000001,DEBIT,200 000002,CREDIT,500 000003,DEBIT,99999 000004,DEBIT,100 000002,INVALID,50
04. Sample output
APPROVED.TXT
APPROVED: 000001 NEW BALANCE: 000000800 APPROVED: 000002 NEW BALANCE: 000000800
REJECTED.TXT
REJECTED: 000003 REASON: EXCEEDS MAX DEBIT REJECTED: 000004 REASON: ACCOUNT NOT FOUND REJECTED: 000002 REASON: INVALID TRANSACTION TYPE
ACCOUNTS-UPDATED.TXT
000001,000000800 000002,000000800 000003,000000050
REPORT.TXT
TOTAL TRANSACTIONS: 000005 TOTAL APPROVED: 000002 TOTAL REJECTED: 000003
05. Run it locally
Because COBOL is compiled and runs on the command line, this project is meant to be cloned and run locally.
# Clone the repo git clone https://github.com/matheuspina-dev/cobol-payment-system.git cd cobol-payment-system # Generate sample data (optional) python generate_data.py # Windows cobc -x src\PAYMENTPROC.cob -o PAYMENTPROC.exe PAYMENTPROC.exe # Linux / macOS cobc -x src/PAYMENTPROC.cob -o PAYMENTPROC ./PAYMENTPROC
06. Why it matters
Batch payment processing is still a core workload in banks, insurance companies, and government agencies. COBOL developers who understand file handling, in-memory table processing, validation, and reporting are in demand for maintaining and modernizing these critical systems.