COBOL Calculation Example - Cobol-variants Typing CST Test
Loading…
COBOL Calculation Example — Cobol-variants Code
Compute total price with tax for a product.
IDENTIFICATION DIVISION.
PROGRAM-ID. CALC-TOTAL.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 PRICE PIC 9(5)V99 VALUE 100.00.
01 TAX-RATE PIC 9(3)V99 VALUE 0.13.
01 TAX-AMOUNT PIC 9(5)V99.
01 TOTAL PIC 9(5)V99.
PROCEDURE DIVISION.
COMPUTE TAX-AMOUNT = PRICE * TAX-RATE.
COMPUTE TOTAL = PRICE + TAX-AMOUNT.
DISPLAY 'Price: ' PRICE.
DISPLAY 'Tax: ' TAX-AMOUNT.
DISPLAY 'Total: ' TOTAL.
STOP RUN.Cobol-variants Language Guide
COBOL Variants refer to the different dialects and implementations of COBOL (Common Business-Oriented Language), a legacy programming language widely used in business, finance, and administrative systems.
Primary Use Cases
- ▸Processing batch payroll and accounting tasks
- ▸Maintaining enterprise resource planning (ERP) systems
- ▸Handling large-scale transaction processing
- ▸Integrating with mainframe databases like DB2 or IMS
- ▸Reporting and regulatory compliance in finance
Notable Features
- ▸Readable English-like syntax
- ▸Structured programming constructs (PERFORM, IF, EVALUATE)
- ▸File handling and batch processing capabilities
- ▸Database integration via embedded SQL
- ▸Object-oriented features in modern COBOL (OO-COBOL)
Origin & Creator
Developed in 1959 by a consortium including CODASYL and led by Grace Hopper to provide a standardized business programming language.
Industrial Note
Extensively used in banking, insurance, government payroll systems, and mainframe applications where decades-old COBOL systems still operate mission-critical workloads.