A terminal-based Payroll Management System built using COBOL, designed to help organizations manage employee records, calculate salaries, and generate payroll reports efficiently.
- ๐ Features
- ๐ Project Structure
- ๐๏ธ System Architecture
- ๐ Salary Calculation
- ๐ง Requirements
- โ๏ธ Installation & Running
- ๐ป Usage
- ๐ธ Screenshots
- ๐๏ธ Sample Data
- โ Future Enhancements
- ๐ ๏ธ Troubleshooting
- ๐ License
- ๐โโ๏ธ Support
โ
Add, Edit, Delete, and Search Employee Records
โ
Calculate Salary with Overtime, Bonus, Deductions, and Tax
โ
Generate Monthly Reports & Salary Slips
โ
Secure Admin Login
โ
Export Data to CSV
โ
Configurable Tax & Overtime Rates
โ
Simple CLI-Based Navigation
| File / Folder | Description |
|---|---|
main.cbl |
Main menu and navigation logic |
employee.cbl |
Employee CRUD operations |
payroll.cbl |
Salary calculation logic |
report.cbl |
Report generation & CSV export |
auth.cbl |
Admin authentication module |
employee.dat |
Flat file storing employee records |
payroll.dat |
Flat file storing payroll transactions |
reports.txt |
Output text report |
employee_export.csv |
Exported employee data (CSV) |
payroll_export.csv |
Exported payroll data (CSV) |
- Main Menu โ CLI with menu-driven options
- Authentication โ Validates admin access
- Employee Module โ Add/Edit/Delete/Search
- Payroll Module โ Salary computation logic
- Reporting Module โ Generates
.txtand.csvreports - File System โ Stores data using flat files
Data Flow:
Admin Login โ Manage Employees โ Process Payroll โ Generate Reports โ Export Data
Gross Salary = Base Salary + (Overtime Hours ร Rate) + Bonus
Tax (10%) = 0.10 ร Gross Salary
Net Salary = Gross Salary - Tax - Deductions
Default Settings:
- Base Work Month: 22 Days
- Overtime Rate:
$100/hour - Tax Rate:
10% - Minimum Salary:
$30,000/year - Max Overtime:
80 hours/month
- COBOL Compiler (GnuCOBOL recommended)
- Terminal / Command Prompt
- Text Editor (VS Code, Vim, Nano)
- 512MB RAM minimum
- 50MB free disk space
Ubuntu/Debian
sudo apt update
sudo apt install gnucobolmacOS
brew install gnu-cobolWindows Download GnuCOBOL from https://gnucobol.sourceforge.io/
mkdir payroll-system
cd payroll-system
touch employee.dat payroll.dat reports.txtcobc -x -o payroll main.cbl employee.cbl payroll.cbl report.cbl auth.cbl./payrollUsername: admin
Password: payroll123
+-------------------------------------+
| PAYROLL MAIN MENU |
+-------------------------------------+
| 1. Manage Employees |
| 2. Compute Payroll |
| 3. Generate Reports |
| 4. Exit |
+-------------------------------------+
Enter choice:
Add Employee
ID: 10001
Name: John Smith
Dept: IT
Base Salary: 75000
Process Payroll
Days Worked: 22
Overtime: 8
Bonus: 1000
Deductions: 200
Calculation
Overtime Pay: 8 ร $100 = $800
Gross: $76,800
Tax: $7,680
Net Salary: $68,920
Payroll Report - December 2025
ID: 10001 | Name: John Smith
Gross: $76,800.00 | Net: $68,920.00
10001John Smith IT Software Engineer 75000.00
10002Jane Doe HR HR Manager 68000.00
10001,22,8,1000,200,7680,76800,68920,12,2025
# Clone the repository
git clone https://github.com/JAGADISHSUNILPEDNEKAR/Payroll_Management_System.git
cd Payroll_Management_System
# Make install script executable
chmod +x scripts/install.sh
# Run installation
./scripts/install.shREM Clone the repository
git clone https://github.com/JAGADISHSUNILPEDNEKAR/Payroll_Management_System.git
cd Payroll_Management_System
REM Run installation
scripts\install.batThe automated installation script will:
- โ Check for GnuCOBOL installation (and attempt to install if missing)
- โ
Create necessary directories (
scripts/,data/) - โ Set up data files with sample employee data
- โ Compile the COBOL program
- โ Set proper file permissions
- โ Verify the installation
After running the installation script, verify everything is working:
# Linux/macOS
./scripts/setup_test.sh
# Windows
scripts\setup_test.batThis will run comprehensive tests to ensure:
- GnuCOBOL is properly installed
- All required files exist
- File permissions are correct
- The program compiles without errors
- Data files have proper format
If you prefer to install manually or the automated script doesn't work:
Ubuntu/Debian
sudo apt update
sudo apt install gnucobolmacOS
brew install gnu-cobolWindows
- Download from https://gnucobol.sourceforge.io/
- Or use Windows Package Manager:
winget install GnuCOBOL
- Add GnuCOBOL to your system PATH
Fedora/RHEL
sudo yum install gnucobol# Create necessary directories
mkdir -p scripts data
# Create data files
touch employee.dat payroll.dat reports.txt
# Add sample employee data to employee.dat
cat > employee.dat << 'EOF'
10001John Smith IT Department Software Engineer 75000.00
10002Jane Doe HR Department HR Manager 68000.00
10003Bob Johnson Finance Department Financial Analyst 62000.00
10004Alice Brown IT Department Senior Developer 85000.00
10005Charlie Wilson Marketing Department Marketing Manager 71000.00
EOFcobc -x -o payroll payroll.cblFor debugging mode:
cobc -x -g -o payroll payroll.cblTo check syntax only:
cobc -fsyntax-only payroll.cblLinux/macOS:
./payrollWindows:
payroll.exeProblem: GnuCOBOL compiler is not installed or not in PATH.
Solutions:
-
Install GnuCOBOL:
- Linux:
sudo apt install gnucobol - macOS:
brew install gnu-cobol - Windows: Download from gnucobol.sourceforge.io
- Linux:
-
Check PATH (Windows):
echo %PATH%
Add GnuCOBOL installation directory to PATH if missing.
-
Verify installation:
cobc --version
Problem: Script doesn't have execute permissions.
Solution:
chmod +x scripts/install.sh
./scripts/install.shProblem: Homebrew package manager is not installed.
Solution:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Problem: COBOL source file has errors or incompatible syntax.
Solutions:
-
Check syntax only:
cobc -fsyntax-only payroll.cbl
-
Common issues:
- Missing periods (
.) at end of statements - Incorrect column alignment (COBOL is column-sensitive)
- Reserved word conflicts
- Missing periods (
-
Verify file encoding: Should be UTF-8 or ASCII
file payroll.cbl
Problem: File path exceeds system limits.
Solution: Move project to a directory with a shorter path.
Problem: Missing system libraries.
Solutions:
- Linux: Install development tools
sudo apt install build-essential
- macOS: Install Xcode Command Line Tools
xcode-select --install
Problem: Data file doesn't exist or program can't access it.
Solutions:
-
Create the file:
touch employee.dat
-
Check current directory:
ls -la *.dat -
Run from correct directory: Ensure you're in the project root
pwd
Problem: File permissions or corruption issues.
Solutions:
-
Check permissions:
ls -l *.dat chmod 644 employee.dat payroll.dat -
Verify file format: Ensure no binary characters in text files
file employee.dat cat -v employee.dat
-
Recreate data files if corrupted:
mv employee.dat employee.dat.backup ./scripts/install.sh
Problem: File format or encoding issues in authentication.
Solutions:
-
Default credentials:
- Username:
admin - Password:
payroll123
- Username:
-
Check for extra spaces: Ensure no trailing spaces when typing
-
Recompile the program:
cobc -x -o payroll payroll.cbl
Problem: Data file format doesn't match COBOL picture clauses.
Solutions:
- Check data alignment: Each field must be in correct position
- Verify numeric fields: Should contain only digits and decimal point
- Use sample data template:
10001John Smith IT Department Software Engineer 75000.00 ^ ^ ^ ^ ^ ID Name (30 chars) Dept (20 chars) Position (25 chars) Salary
Problem: "error while loading shared libraries: libcob.so.4"
Solution:
sudo ldconfig
# Or set LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATHProblem: "dyld: Library not loaded"
Solution:
# Reinstall GnuCOBOL
brew reinstall gnu-cobol
# Or set DYLD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATHProblem: "The code execution cannot proceed because libcob-4.dll was not found"
Solutions:
- Reinstall GnuCOBOL
- Add GnuCOBOL bin directory to PATH
- Copy required DLLs to program directory
Problem: Line endings causing issues
Solution: Convert line endings to CRLF
dos2unix -k payroll.cblProblem: Large data files or disk I/O bottleneck.
Solutions:
-
Check file size:
du -h *.dat -
Archive old payroll records:
mv payroll.dat payroll_2024.dat touch payroll.dat
-
Use indexed files (advanced): Modify file organization in COBOL
Problem: Infinite loop or waiting for input.
Solutions:
-
Force quit:
- Linux/macOS:
Ctrl+C - Windows:
Ctrl+Break
- Linux/macOS:
-
Check for input prompts: Ensure all ACCEPT statements work correctly
-
Add timeout to testing:
timeout 10s ./payroll
Problem: Tax rate or formula issues.
Solutions:
-
Verify constants:
- Default tax rate: 10% (0.10)
- Overtime rate: $100/hour
- Working days: 22 days/month
-
Recalculate manually:
Gross = Base Salary + (OT Hours ร $100) + Bonus Tax = Gross ร 0.10 Net = Gross - Tax - Deductions -
Check data types: Ensure numeric fields don't have text
Problem: Records show garbled or incorrect data.
Solutions:
-
Backup current data:
cp employee.dat employee.dat.backup
-
Check record format: Each record must be exactly as defined
- Employee ID: 5 digits
- Name: 30 characters (padded with spaces)
- Department: 20 characters
- Position: 25 characters
- Salary: 9 digits with 2 decimals
-
Manually fix or recreate: Edit with care to maintain alignment
If you're still experiencing issues:
-
Check existing issues: GitHub Issues
-
Create a new issue with:
- Operating system and version
- GnuCOBOL version (
cobc --version) - Complete error message
- Steps to reproduce
- What you've already tried
-
Contact maintainer: jsphere16@gmail.com
-
Community resources:
If you want to install to a custom directory:
# Create custom directory
mkdir -p /opt/payroll-system
cd /opt/payroll-system
# Clone and install
git clone https://github.com/JAGADISHSUNILPEDNEKAR/Payroll_Management_System.git .
./scripts/install.shYou can set these environment variables for customization:
# Linux/macOS
export PAYROLL_DATA_DIR="/path/to/data"
export PAYROLL_REPORTS_DIR="/path/to/reports"
# Windows
set PAYROLL_DATA_DIR=C:\path\to\data
set PAYROLL_REPORTS_DIR=C:\path\to\reportsTo run multiple instances:
# Instance 1
mkdir payroll-dept1
cd payroll-dept1
git clone https://github.com/JAGADISHSUNILPEDNEKAR/Payroll_Management_System.git .
./scripts/install.sh
# Instance 2
mkdir payroll-dept2
cd payroll-dept2
git clone https://github.com/JAGADISHSUNILPEDNEKAR/Payroll_Management_System.git .
./scripts/install.sh- CPU: Any x86/x64 processor (1 GHz+)
- RAM: 512 MB
- Disk: 50 MB free space
- OS: Linux, macOS 10.12+, Windows 7+
- CPU: Dual-core processor (2 GHz+)
- RAM: 2 GB
- Disk: 200 MB free space (for data growth)
- OS: Linux (Ubuntu 20.04+), macOS 11+, Windows 10+
- โ Ubuntu 20.04, 22.04, 24.04
- โ Debian 11, 12
- โ macOS Monterey, Ventura, Sonoma
- โ Windows 10, 11
- โ Fedora 38+
- โ RHEL 8, 9
# Save your data files
cp employee.dat employee.dat.backup
cp payroll.dat payroll.dat.backup
# Pull updates
git pull origin main
# Recompile
cobc -x -o payroll payroll.cbl
# Restore data if needed
cp employee.dat.backup employee.dat
cp payroll.dat.backup payroll.datIf data format changes between versions:
- Export current data to CSV (if feature available)
- Update to new version
- Import data back or manually convert
Linux/macOS:
# Remove executable
rm -f payroll
# Remove data files (WARNING: This deletes all data!)
rm -f employee.dat payroll.dat reports.txt
# Remove entire directory
cd ..
rm -rf Payroll_Management_SystemWindows:
REM Remove executable
del payroll.exe
REM Remove data files
del employee.dat payroll.dat reports.txt
REM Remove directory
cd ..
rmdir /s /q Payroll_Management_System# Backup data
mkdir payroll-backup
cp *.dat reports.txt payroll-backup/
# Remove program
rm payroll
rm payroll.cbl enhanced_modules.cbl# Standard compilation
cobc -x -o payroll payroll.cbl
# Debug mode
cobc -x -g -o payroll payroll.cbl
# Syntax check only
cobc -fsyntax-only payroll.cbl
# Verbose output
cobc -x -v -o payroll payroll.cbl# View employee data
cat employee.dat
# Count employees
wc -l employee.dat
# Search for employee
grep "10001" employee.dat
# Backup all data
tar -czf payroll-backup-$(date +%Y%m%d).tar.gz *.dat reports.txt# Run verification
./scripts/setup_test.sh
# Check file integrity
file *.dat
# Validate permissions
ls -la *.dat- Regular backups: Backup data files weekly
- Archive old records: Move old payroll.dat entries to archive files
- Test on sample data: Use test data before processing real payroll
- Validate inputs: Always verify data before saving
- Change default password: Modify WS-VALID-PASS in payroll.cbl
- Restrict file permissions:
chmod 600for sensitive data - Use separate user accounts: Don't run as root/administrator
- Audit trail: Keep logs of who accesses the system
- Keep data files reasonable size: Archive after 1000+ records
- Index frequently searched fields: Consider indexed file organization
- Regular maintenance: Clean up temporary files
- Monitor disk space: Ensure sufficient space for reports
- CONTRIBUTING.md - How to contribute
- CODE_OF_CONDUCT.md - Community guidelines
- LICENSE - MIT License terms
- ๐ Role-based Authentication
- ๐ Graphical Report Output (CSV/HTML)
- ๐ Web Interface using COBOL-Web bridge
- ๐๏ธ VSAM / Indexed File / SQL DB Integration
- ๐ Backup & Restore functionality
- ๐ก๏ธ Better Input Validation & Logging
| Issue | Fix |
|---|---|
| โ Compilation Error | Check COBOL syntax and ensure IDENTIFICATION, PROCEDURE divisions |
| ๐๏ธ File Error | Ensure .dat files exist and have correct permissions |
| ๐งฎ Wrong Output | Validate inputs and verify salary formula |
This project is licensed under the MIT License ยฉ 2025 JAGADISH SUNIL PEDNEKAR.
If you like this project, give it a โญ at Payroll_Management_System. For issues or suggestions, open an Issue.
๐ Last Updated: June 2025 ๐ฆ Version: 1.0 ๐ Status: Production Ready