A COBOL bank ledger system demonstrating classic mainframe-style banking. This system simulates a bank teller workstation.
- Account Management: Create new accounts with complete customer information
- Account Information: View account details with integrated transaction history
- Deposits & Withdrawals: Process monetary transactions with balance updates
- Transfers: Move funds between accounts
- Transaction History: Complete audit trail with dates, descriptions, and amounts
- Data Persistence: Indexed files for accounts, sequential files for transactions
- Sample Data: Pre-populated with 5 accounts and realistic transaction history
- Easy Reset: Single command to reset database to baseline state
- Error Handling: Clear status messages for all operations
-
Install Homebrew (if not already installed):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -
Install GnuCOBOL:
brew install gnu-cobol
-
Verify installation:
cobc --version
GnuCOBOL may require additional libraries:
brew install gmp berkeley-dbledger-cobol/
├── src/ # Main COBOL source files
│ └── BANKLED.cob # Main program with all functionality
├── copybooks/ # Reusable data structures
│ ├── ACCOUNT.cpy # Account record definition
│ ├── TRANS.cpy # Transaction record definition
│ └── COMMON.cpy # Common constants and messages
├── data/ # Data files (created on first run)
│ ├── accounts.dat # Indexed account master file
│ └── trans.dat # Sequential transaction log
├── scripts/ # Utility scripts
│ └── reset-db.sh # Database reset script
├── bin/ # Compiled executables (created on build)
├── Makefile # Build system
-
Build the application:
make build
-
Reset database with sample data:
make reset
-
Run the application:
make run
The system presents a traditional mainframe-style menu interface:
-
Create New Account - Add new customer accounts
- Enter customer details (name, address, phone)
- Choose account type (Checking/Savings)
- Automatically assigns next available account number
-
Account Information - View comprehensive account details
- Select account from numbered list
- Displays account holder information
- Shows current balance in highlighted box
- Lists transaction history with dates and descriptions
-
Deposit - Add funds to account
- Select account using intuitive interface
- Enter deposit amount
- Updates balance immediately
-
Withdrawal - Remove funds from account
- Select account with validation
- Ensures sufficient funds before processing
- Updates balance and logs transaction
-
Transfer - Move funds between accounts
- Clear prompts for source account (FROM)
- Separate prompt for destination account (TO)
- Displays comprehensive summary with both account balances
-
Exit - Close application safely
make build # Compile the application
make clean # Remove build artifacts
make debug # Build with debug informationmake run # Run the application
make reset # Reset database to baseline with sample data
make init-data # Initialize empty data filesmake test # Run unit tests
make check-deps # Verify GnuCOBOL installation-
File Status Errors
- Status 22: Usually indicates duplicate key or file attribute mismatch
- Status 39: File attribute mismatch between create and read
- Solution: Run
make resetto ensure consistent file structures
-
Berkeley DB Warnings
- "unexpected file type or format" warnings are normal
- The application handles these gracefully
-
Account Creation Issues
- New accounts start at 1000000006 (after the 5 sample accounts)
- Ensure you run
make resetif you get duplicate key errors
- Uses GnuCOBOL's free format (-free flag)
- Follows COBOL 2014 standard
- Traditional COBOL programming patterns with modern enhancements
- All business logic contained in single source file for simplicity
- Copybooks provide shared data structures
- No external dependencies beyond GnuCOBOL runtime
Feel free to submit issues or pull requests to improve the system.
This project is licensed under the MIT License - see the LICENSE file for details.