Chapter 1 Exercises: The World of COBOL
These exercises are organized into five tiers of increasing cognitive complexity, following Bloom's taxonomy. Work through each tier sequentially, as later exercises build on the knowledge tested by earlier ones.
Tier 1: Recall (Knowledge Check)
These exercises test your ability to remember key facts and terminology from the chapter.
Exercise R-1: Key Dates
List the year each of the following occurred: 1. The CODASYL conference at the Pentagon 2. The release of the first COBOL specification 3. The first ANSI standardization of COBOL 4. The COBOL-85 standard (which introduced structured programming) 5. The introduction of object-oriented features in a COBOL standard
Exercise R-2: Acronym Expansion
Write the full expansion of each acronym: 1. COBOL 2. CODASYL 3. JCL 4. CICS 5. VSAM 6. DB2 7. KSDS 8. ANSI
Exercise R-3: The Four Divisions
Name the four divisions of a COBOL program in order and write a one-sentence description of each division's purpose.
Exercise R-4: Column Layout
In fixed-format COBOL, identify what belongs in each of the following column ranges: 1. Columns 1-6 2. Column 7 3. Columns 8-11 4. Columns 12-72 5. Columns 73-80
Exercise R-5: COBOL by the Numbers
Fill in the blanks with the approximate figures cited in the chapter: 1. _ billion lines of COBOL code are in active production use worldwide. 2. _ percent of ATM transactions are processed by COBOL programs. 3. $_ trillion in daily commerce flows through COBOL systems. 4. _ percent of banking systems are built on COBOL.
Exercise R-6: Key Figures
Who is Grace Hopper, and what were her three most significant contributions to computing as described in this chapter?
Exercise R-7: PICTURE Clause Symbols
Match each PIC symbol with its meaning:
1. 9
2. X
3. A
4. V
5. S
6. Z
Meanings: (a) Alphabetic character, (b) Numeric digit, (c) Sign indicator, (d) Zero suppression, (e) Implied decimal point, (f) Alphanumeric character
Tier 2: Understand (Explain Concepts)
These exercises test your ability to explain concepts in your own words and demonstrate comprehension.
Exercise U-1: Design Philosophy Explained
In a paragraph of 100-150 words, explain why COBOL was designed to have verbose, English-like syntax rather than the concise mathematical notation used by FORTRAN. Who was the intended audience for COBOL code, and how did this influence the language's design?
Exercise U-2: The Punch Card Connection
Explain the historical connection between 80-column punch cards and COBOL's fixed-format source layout. Why does the fixed format divide the line into the specific column ranges it uses? What was the purpose of each area?
Exercise U-3: Portability by Design
Explain how COBOL's four-division structure supports the goal of hardware portability. Specifically, explain why the ENVIRONMENT DIVISION was separated from the PROCEDURE DIVISION and what advantage this provides when moving a program from one computer system to another.
Exercise U-4: Batch vs. Online Processing
In your own words, explain the difference between batch processing and online transaction processing (CICS) in the mainframe environment. Give two examples of business tasks that would be handled by batch processing and two that would require online processing.
Exercise U-5: The Skills Gap
Summarize the COBOL skills gap crisis in 150-200 words. Your summary should address: (a) the cause of the gap, (b) the consequences for organizations, and (c) the opportunity it presents for new COBOL learners.
Exercise U-6: COBOL-85 Significance
Explain why COBOL-85 is considered the most important revision of the COBOL standard. What specific features did it introduce, and how did they change the way COBOL programs were written?
Exercise U-7: Self-Documenting Code
COBOL is often described as "self-documenting." Explain what this means by comparing a COBOL arithmetic statement with its equivalent in a language like Python or Java. What are the advantages and disadvantages of COBOL's verbose approach?
Tier 3: Apply (Write Simple Code)
These exercises require you to write COBOL code or apply concepts from the chapter to practical tasks.
Exercise A-1: Personal Greeting Program
Write a complete COBOL program in fixed format that: 1. Displays your name 2. Displays today's date (use FUNCTION CURRENT-DATE) 3. Displays a personal greeting message of your choice
The program must include all four divisions, proper column alignment, and at least two comments.
Exercise A-2: Temperature Converter
Write a COBOL program that converts a temperature from Fahrenheit to Celsius using the formula: C = (F - 32) * 5 / 9. The program should:
1. Define a Fahrenheit value in WORKING-STORAGE (use 212 as the initial value)
2. Calculate the Celsius equivalent using the COMPUTE statement
3. Display both values with appropriate labels
4. Use properly defined PIC clauses for all variables
Exercise A-3: Simple Invoice Calculator
Create a COBOL program that calculates the total cost of an order with three items. The program should:
1. Define three item prices in WORKING-STORAGE (use values of your choice)
2. Calculate the subtotal by adding all three prices
3. Apply an 8.5% sales tax
4. Display the subtotal, tax amount, and total, each with a label
5. Use edited PICTURE clauses for the display (e.g., PIC $ZZ,ZZ9.99)
Exercise A-4: Column Alignment Exercise
The following COBOL code has column alignment errors. Rewrite it with correct fixed-format alignment. Identify each error.
IDENTIFICATION DIVISION.
PROGRAM-ID. FIXME.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-NAME PIC X(20) VALUE "TEST".
PROCEDURE DIVISION.
MAIN-PARA.
DISPLAY WS-NAME.
STOP RUN.
Exercise A-5: Four Divisions Demo
Write a complete COBOL program that demonstrates all four divisions. In the WORKING-STORAGE SECTION, define variables for: - Your name (alphanumeric) - Your city (alphanumeric) - Your favorite programming language (alphanumeric)
In the PROCEDURE DIVISION, display all three variables in a formatted output with labels. Include at least one entry in the ENVIRONMENT DIVISION's CONFIGURATION SECTION.
Exercise A-6: PIC Clause Practice
For each of the following data requirements, write the appropriate PIC clause: 1. A 9-digit Social Security Number (numeric only) 2. A person's last name (up to 25 characters, any character type) 3. A dollar amount up to $99,999.99 (with sign) 4. A 5-digit zip code 5. A date in YYYYMMDD format (numeric) 6. An employee ID that is 2 letters followed by 4 digits (hint: use alphanumeric) 7. A percentage with one decimal place (e.g., 99.9%) 8. A display field that suppresses leading zeros for a 6-digit number
Exercise A-7: Arithmetic Verbs
Write a COBOL program that demonstrates all five arithmetic operations (ADD, SUBTRACT, MULTIPLY, DIVIDE, COMPUTE). Use two predefined numbers (e.g., 250 and 15) and display the result of each operation with a descriptive label. Include the REMAINDER clause with the DIVIDE operation.
Tier 4: Analyze (Compare and Evaluate)
These exercises require you to compare, contrast, analyze, and evaluate concepts.
Exercise AN-1: COBOL vs. Python Comparison
Compare and contrast COBOL and Python across the following dimensions. For each dimension, identify which language has the advantage and explain why.
| Dimension | COBOL | Python |
|---|---|---|
| Readability for non-programmers | ||
| Readability for programmers | ||
| Decimal arithmetic precision | ||
| Learning curve | ||
| Ecosystem maturity for business applications | ||
| Job market demand-to-supply ratio | ||
| Code verbosity | ||
| Modern development tooling |
Exercise AN-2: Fixed vs. Free Format Analysis
Analyze the advantages and disadvantages of fixed-format and free-format COBOL. Consider: 1. Readability and visual structure 2. Ease of writing new code 3. Maintenance of existing code 4. Error susceptibility 5. Compatibility with modern development tools (editors, version control)
Write a recommendation (200-300 words) for which format a team should adopt for a new COBOL project, justifying your choice.
Exercise AN-3: Modernization Strategy Evaluation
A mid-sized insurance company has 8 million lines of COBOL code running on an IBM mainframe. They are considering three modernization strategies: 1. Rewrite: Replace all COBOL code with Java microservices 2. Wrap: Keep COBOL code and expose it through REST APIs 3. Hybrid: Migrate some components to Java while keeping core COBOL systems
For each strategy, analyze: - Estimated risk level (low, medium, high) - Estimated time to complete (years) - Impact on existing COBOL developers - Impact on business continuity - Long-term maintainability
Which strategy would you recommend and why?
Exercise AN-4: The COBOL Standards Timeline
Create a timeline analysis of COBOL standards from 1960 to 2014. For each major standard, identify: 1. The most important new feature(s) introduced 2. The business or technology trend that drove the change 3. How the new features affected the way COBOL programs were written
Based on your analysis, what do you predict might be included in a future COBOL standard? Justify your prediction.
Exercise AN-5: Mainframe vs. Cloud Cost Analysis
A financial services company processes 50 million transactions per day using COBOL on an IBM mainframe. They are evaluating whether to move these workloads to the cloud. Analyze the following factors:
- Reliability: Compare mainframe 99.999% uptime with typical cloud SLAs
- Security: Compare hardware-level mainframe encryption with cloud security models
- Cost: Consider mainframe licensing vs. cloud pay-per-use (note: high-volume transaction costs can be significant in the cloud)
- Talent: Consider the availability of mainframe vs. cloud developers
- Regulatory: Consider banking regulators' views on cloud computing for core systems
Write a 300-400 word analysis with a recommendation.
Exercise AN-6: Code Quality Analysis
Examine the following two COBOL code fragments that perform the same task. Analyze which is better written and explain your reasoning based on COBOL best practices discussed in this chapter.
Fragment A:
PROCEDURE DIVISION.
A.
MOVE 100 TO X.
MOVE 50 TO Y.
ADD X Y GIVING Z.
DISPLAY Z.
STOP RUN.
Fragment B:
PROCEDURE DIVISION.
CALCULATE-ORDER-TOTAL.
MOVE 100 TO WS-ITEM-PRICE
MOVE 50 TO WS-SHIPPING-COST
ADD WS-ITEM-PRICE TO WS-SHIPPING-COST
GIVING WS-ORDER-TOTAL
END-ADD
DISPLAY "ORDER TOTAL: " WS-ORDER-TOTAL
STOP RUN.
Tier 5: Create (Design and Build)
These exercises require you to design solutions, create original programs, and synthesize knowledge from across the chapter.
Exercise C-1: Student Grade Report System
Design a complete COBOL program outline (you may write pseudocode using COBOL structure) for a student grade report system that: 1. Reads student records from a file (define the record layout) 2. Calculates the average grade for each student 3. Assigns a letter grade (A, B, C, D, F) based on the average 4. Writes a formatted report to an output file 5. Calculates and displays the class average at the end
Your design should include: - Complete IDENTIFICATION DIVISION - ENVIRONMENT DIVISION with FILE-CONTROL entries - DATA DIVISION with FILE SECTION and WORKING-STORAGE SECTION - PROCEDURE DIVISION organized into logical paragraphs
You do not need to write every line of executable code, but your paragraph structure and data definitions should be complete and correct.
Exercise C-2: COBOL History Presentation
Create a detailed outline for a 15-minute presentation titled "Why COBOL Still Matters in 2026." Your outline should include: 1. An attention-getting opening (cite a specific statistic) 2. Three main points with supporting evidence from the chapter 3. At least one counter-argument ("Isn't COBOL dead?") with a rebuttal 4. A conclusion that includes a call to action for the audience 5. A list of at least five sources you would cite
Exercise C-3: Modernization Proposal
Write a one-page (500-600 word) modernization proposal for a fictional company called "National Auto Insurance" that has 12 million lines of COBOL code running their policy management system. Your proposal should include: 1. Executive summary (2-3 sentences) 2. Current state assessment 3. Proposed modernization approach (choose from strategies discussed in the chapter) 4. Timeline and phases 5. Risk mitigation strategy 6. Expected benefits 7. Staffing recommendations (how many COBOL developers, what training)
Exercise C-4: COBOL Program - Simple Payroll Calculator
Write a complete, compilable COBOL program that calculates the weekly net pay for an employee. The program should: 1. Define the following in WORKING-STORAGE: - Employee name (alphanumeric, 30 characters) - Hours worked (numeric, up to 99.9) - Hourly rate (numeric, up to 999.99) - Gross pay (computed) - Federal tax at 22% (computed) - State tax at 5% (computed) - Social Security at 6.2% (computed) - Medicare at 1.45% (computed) - Net pay (computed) 2. Calculate gross pay (hours * rate) 3. Calculate each deduction 4. Calculate net pay (gross minus all deductions) 5. Display a formatted pay stub showing all amounts
Use meaningful variable names, proper PIC clauses, and at least three comments.
Exercise C-5: Technology Stack Diagram
Create a detailed text-based diagram (using ASCII art or a structured outline) showing the mainframe technology stack discussed in this chapter. Your diagram should show the relationships between: - z/OS operating system - JCL (job scheduling) - CICS (online transactions) - Batch processing - COBOL programs - DB2 (relational database) - VSAM (file storage) - End users (ATMs, terminals, web interfaces)
Label each component and add brief annotations explaining the data flow between components.
Exercise C-6: Learning Plan
Create a 12-week COBOL learning plan for yourself. For each week, specify: 1. The topic or skill to be learned 2. Specific learning activities (reading, coding exercises, projects) 3. A measurable outcome (e.g., "Can write a program that reads a file and produces a report") 4. Resources you will use
Your plan should progress from the basics covered in this chapter through intermediate skills (file handling, report generation) to advanced topics (CICS programming, DB2 integration).
Submission Guidelines
- All COBOL code should be written in fixed format with proper column alignment unless the exercise specifically requests free format.
- Use meaningful variable names with the
WS-prefix for WORKING-STORAGE items. - Include comments in all programs explaining the purpose and any non-obvious logic.
- Test your programs with GnuCOBOL if you have access to a COBOL compiler.
- Written responses should be clear, well-organized, and supported by references to chapter content.
- Solutions for selected exercises (A-1, A-2, A-3, A-5, and C-1) are available in
code/exercise-solutions.cob.