Skip to content

A terminal-based Payroll Management System built using COBOL, designed to help organizations manage employee records, calculate salaries, and generate payroll reports

License

Notifications You must be signed in to change notification settings

Aman-Cool/Payroll_Management_System

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

19 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ’ผ Payroll Management System (COBOL)

A terminal-based Payroll Management System built using COBOL, designed to help organizations manage employee records, calculate salaries, and generate payroll reports efficiently.

License Status Platform


๐Ÿ“œ Table of Contents


๐Ÿš€ Features

โœ… 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


๐Ÿ“‚ Project Structure

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)

๐Ÿ—๏ธ System Architecture

  • 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 .txt and .csv reports
  • File System โ€“ Stores data using flat files

Data Flow:
Admin Login โ†’ Manage Employees โ†’ Process Payroll โ†’ Generate Reports โ†’ Export Data


๐Ÿ“Š Salary Calculation

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

๐Ÿ”ง Requirements

Software

  • COBOL Compiler (GnuCOBOL recommended)
  • Terminal / Command Prompt
  • Text Editor (VS Code, Vim, Nano)

Hardware

  • 512MB RAM minimum
  • 50MB free disk space

โš™๏ธ Installation & Running

1๏ธโƒฃ Install GnuCOBOL

Ubuntu/Debian

sudo apt update
sudo apt install gnucobol

macOS

brew install gnu-cobol

Windows Download GnuCOBOL from https://gnucobol.sourceforge.io/


2๏ธโƒฃ Setup Files

mkdir payroll-system
cd payroll-system
touch employee.dat payroll.dat reports.txt

3๏ธโƒฃ Compile the COBOL Source

cobc -x -o payroll main.cbl employee.cbl payroll.cbl report.cbl auth.cbl

4๏ธโƒฃ Run the Program

./payroll

๐Ÿ’ป Usage

๐Ÿ›ก๏ธ Login

Username: admin  
Password: payroll123

๐Ÿงญ Menu Interface

+-------------------------------------+
|        PAYROLL MAIN MENU           |
+-------------------------------------+
| 1. Manage Employees                |
| 2. Compute Payroll                 |
| 3. Generate Reports                |
| 4. Exit                            |
+-------------------------------------+
Enter choice:

๐Ÿงช Sample Workflow

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  

๐Ÿ“ธ Screenshots

Screenshot 2025-06-18 at 1 56 12โ€ฏPM Screenshot 2025-06-18 at 1 56 26โ€ฏPM
Payroll Report - December 2025
ID: 10001 | Name: John Smith  
Gross: $76,800.00 | Net: $68,920.00

๐Ÿ—‚๏ธ Sample Data

employee.dat

10001John Smith                  IT                  Software Engineer        75000.00
10002Jane Doe                    HR                  HR Manager               68000.00

payroll.dat

10001,22,8,1000,200,7680,76800,68920,12,2025

โš™๏ธ Quick Start Installation

๐Ÿš€ Automated Installation (Recommended)

Linux/macOS

# 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.sh

Windows

REM Clone the repository
git clone https://github.com/JAGADISHSUNILPEDNEKAR/Payroll_Management_System.git
cd Payroll_Management_System

REM Run installation
scripts\install.bat

๐Ÿ“‹ What the Installation Script Does

The 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

๐Ÿงช Verify Your Installation

After running the installation script, verify everything is working:

# Linux/macOS
./scripts/setup_test.sh

# Windows
scripts\setup_test.bat

This 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

โš™๏ธ Manual Installation

If you prefer to install manually or the automated script doesn't work:

1๏ธโƒฃ Install GnuCOBOL

Ubuntu/Debian

sudo apt update
sudo apt install gnucobol

macOS

brew install gnu-cobol

Windows

Fedora/RHEL

sudo yum install gnucobol

2๏ธโƒฃ Setup Files

# 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
EOF

3๏ธโƒฃ Compile the COBOL Source

cobc -x -o payroll payroll.cbl

For debugging mode:

cobc -x -g -o payroll payroll.cbl

To check syntax only:

cobc -fsyntax-only payroll.cbl

4๏ธโƒฃ Run the Program

Linux/macOS:

./payroll

Windows:

payroll.exe

๐Ÿ› ๏ธ Comprehensive Troubleshooting

Installation Issues

โŒ "cobc: command not found" or "GnuCOBOL not found"

Problem: GnuCOBOL compiler is not installed or not in PATH.

Solutions:

  1. Install GnuCOBOL:

  2. Check PATH (Windows):

    echo %PATH%

    Add GnuCOBOL installation directory to PATH if missing.

  3. Verify installation:

    cobc --version

โŒ "Permission denied" when running install.sh

Problem: Script doesn't have execute permissions.

Solution:

chmod +x scripts/install.sh
./scripts/install.sh

โŒ "Homebrew not found" on macOS

Problem: Homebrew package manager is not installed.

Solution:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Compilation Errors

โŒ Compilation fails with syntax errors

Problem: COBOL source file has errors or incompatible syntax.

Solutions:

  1. Check syntax only:

    cobc -fsyntax-only payroll.cbl
  2. Common issues:

    • Missing periods (.) at end of statements
    • Incorrect column alignment (COBOL is column-sensitive)
    • Reserved word conflicts
  3. Verify file encoding: Should be UTF-8 or ASCII

    file payroll.cbl

โŒ "error: EMPLOYEE-FILE: File name too long"

Problem: File path exceeds system limits.

Solution: Move project to a directory with a shorter path.

โŒ Linker errors during compilation

Problem: Missing system libraries.

Solutions:

  • Linux: Install development tools
    sudo apt install build-essential
  • macOS: Install Xcode Command Line Tools
    xcode-select --install

Runtime Errors

โŒ "File not found: employee.dat"

Problem: Data file doesn't exist or program can't access it.

Solutions:

  1. Create the file:

    touch employee.dat
  2. Check current directory:

    ls -la *.dat
  3. Run from correct directory: Ensure you're in the project root

    pwd

โŒ "File status 35" or I/O errors

Problem: File permissions or corruption issues.

Solutions:

  1. Check permissions:

    ls -l *.dat
    chmod 644 employee.dat payroll.dat
  2. Verify file format: Ensure no binary characters in text files

    file employee.dat
    cat -v employee.dat
  3. Recreate data files if corrupted:

    mv employee.dat employee.dat.backup
    ./scripts/install.sh

โŒ "Login Failed" even with correct credentials

Problem: File format or encoding issues in authentication.

Solutions:

  1. Default credentials:

    • Username: admin
    • Password: payroll123
  2. Check for extra spaces: Ensure no trailing spaces when typing

  3. Recompile the program:

    cobc -x -o payroll payroll.cbl

โŒ "Invalid numeric data" or calculation errors

Problem: Data file format doesn't match COBOL picture clauses.

Solutions:

  1. Check data alignment: Each field must be in correct position
  2. Verify numeric fields: Should contain only digits and decimal point
  3. Use sample data template:
    10001John Smith                  IT Department        Software Engineer        75000.00
    ^    ^                           ^                    ^                        ^
    ID   Name (30 chars)             Dept (20 chars)      Position (25 chars)      Salary
    

Platform-Specific Issues

๐Ÿง Linux Issues

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_PATH

๐ŸŽ macOS Issues

Problem: "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_PATH

๐ŸชŸ Windows Issues

Problem: "The code execution cannot proceed because libcob-4.dll was not found"

Solutions:

  1. Reinstall GnuCOBOL
  2. Add GnuCOBOL bin directory to PATH
  3. Copy required DLLs to program directory

Problem: Line endings causing issues

Solution: Convert line endings to CRLF

dos2unix -k payroll.cbl

Performance Issues

โŒ Slow file operations

Problem: Large data files or disk I/O bottleneck.

Solutions:

  1. Check file size:

    du -h *.dat
  2. Archive old payroll records:

    mv payroll.dat payroll_2024.dat
    touch payroll.dat
  3. Use indexed files (advanced): Modify file organization in COBOL

โŒ Program hangs or freezes

Problem: Infinite loop or waiting for input.

Solutions:

  1. Force quit:

    • Linux/macOS: Ctrl+C
    • Windows: Ctrl+Break
  2. Check for input prompts: Ensure all ACCEPT statements work correctly

  3. Add timeout to testing:

    timeout 10s ./payroll

Data Issues

โŒ Reports show incorrect calculations

Problem: Tax rate or formula issues.

Solutions:

  1. Verify constants:

    • Default tax rate: 10% (0.10)
    • Overtime rate: $100/hour
    • Working days: 22 days/month
  2. Recalculate manually:

    Gross = Base Salary + (OT Hours ร— $100) + Bonus
    Tax = Gross ร— 0.10
    Net = Gross - Tax - Deductions
    
  3. Check data types: Ensure numeric fields don't have text

โŒ Employee data appears corrupted

Problem: Records show garbled or incorrect data.

Solutions:

  1. Backup current data:

    cp employee.dat employee.dat.backup
  2. 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
  3. Manually fix or recreate: Edit with care to maintain alignment


Getting Help

If you're still experiencing issues:

  1. Check existing issues: GitHub Issues

  2. Create a new issue with:

    • Operating system and version
    • GnuCOBOL version (cobc --version)
    • Complete error message
    • Steps to reproduce
    • What you've already tried
  3. Contact maintainer: jsphere16@gmail.com

  4. Community resources:


๐Ÿ”ง Advanced Configuration

Custom Installation Path

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.sh

Environment Variables

You 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\reports

Multiple Installations

To 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

๐Ÿ“Š System Requirements

Minimum Requirements

  • CPU: Any x86/x64 processor (1 GHz+)
  • RAM: 512 MB
  • Disk: 50 MB free space
  • OS: Linux, macOS 10.12+, Windows 7+

Recommended Requirements

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

Tested Platforms

  • โœ… Ubuntu 20.04, 22.04, 24.04
  • โœ… Debian 11, 12
  • โœ… macOS Monterey, Ventura, Sonoma
  • โœ… Windows 10, 11
  • โœ… Fedora 38+
  • โœ… RHEL 8, 9

๐Ÿ”„ Updating the System

Pull Latest Changes

# 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.dat

Migration Between Versions

If data format changes between versions:

  1. Export current data to CSV (if feature available)
  2. Update to new version
  3. Import data back or manually convert

๐Ÿงน Uninstallation

Complete Removal

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_System

Windows:

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

Keep Data, Remove Program

# Backup data
mkdir payroll-backup
cp *.dat reports.txt payroll-backup/

# Remove program
rm payroll
rm payroll.cbl enhanced_modules.cbl

๐Ÿ“ Quick Reference Commands

Compilation

# 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

File Management

# 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

Testing

# Run verification
./scripts/setup_test.sh

# Check file integrity
file *.dat

# Validate permissions
ls -la *.dat

๐ŸŽฏ Best Practices

Data Management

  • 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

Security

  • Change default password: Modify WS-VALID-PASS in payroll.cbl
  • Restrict file permissions: chmod 600 for sensitive data
  • Use separate user accounts: Don't run as root/administrator
  • Audit trail: Keep logs of who accesses the system

Performance

  • 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

๐Ÿ“š Additional Resources

Documentation

External Resources

โœ… Future Enhancements

  • ๐Ÿ” 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

๐Ÿ› ๏ธ Troubleshooting

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

๐Ÿ“ƒ License

This project is licensed under the MIT License ยฉ 2025 JAGADISH SUNIL PEDNEKAR.


๐Ÿ™‹โ€โ™‚๏ธ Support

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

About

A terminal-based Payroll Management System built using COBOL, designed to help organizations manage employee records, calculate salaries, and generate payroll reports

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • COBOL 48.2%
  • Batchfile 26.9%
  • Shell 24.9%