Master Mainframe Technologies - COBOL, JCL, DB2, VSAM, CICS & More
ABEND Codes SQLCODEs File Status Interview Prep Contact

Practice Problems

Master COBOL, JCL, and mainframe skills with real-world scenarios

109
Total Problems
38
Beginner
47
Intermediate
24
Advanced

🟢 COBOL Basics

COBOL
Write a COBOL program that displays "HELLO, MAINFRAME WORLD!" on the screen....
hello-world display basics
COBOL
Write a program that accepts a user's name and displays a personalized greeting....
accept input working-storage
COBOL
Write a program that displays the current date in MM/DD/YYYY format....
date accept formatting
COBOL
Write a COBOL program that displays "Welcome to COBOL Programming" and demonstrates all four divisions....
basics structure divisions
COBOL
Write a program that accepts user name and displays a personalized greeting....
accept display input output
Beginner
COBOL
Write a well-commented program that calculates area of rectangle....
comments documentation basics
COBOL
Explain and demonstrate the difference between STOP RUN and GOBACK....
stop-run goback termination
COBOL
Create a program demonstrating proper use of COBOL reserved words like MOVE, ADD, DISPLAY....
reserved-words syntax basics
COBOL
Use INITIALIZE to set fields to default values....
initialize reset default
Intermediate
COBOL
Concatenate multiple fields using STRING statement....
string concatenate delimited
Intermediate
COBOL
Use INSPECT to count and replace characters....
inspect tallying replacing converting

📊 Data Division

COBOL
Demonstrate different numeric PIC clauses: 9, S, V, P....
pic numeric data-types
COBOL
Work with alphanumeric (PIC X) and alphabetic (PIC A) data types....
alphanumeric alphabetic pic-x
COBOL
Create a record structure with group and elementary items....
group elementary record structure
Intermediate
COBOL
Explain and use computational data types COMP, COMP-1, COMP-2, COMP-3....
comp comp-3 binary packed-decimal
Intermediate
COBOL
Format numbers for display using edited PIC clauses: Z, *, $, comma, period....
edited-pic formatting display
Intermediate
COBOL
Use REDEFINES to interpret same storage in multiple ways....
redefines storage data-types

🔢 Arithmetic Operations

Beginner
COBOL
Write a program that accepts two numbers and displays their sum....
add arithmetic numeric
COBOL
Accept 5 numbers and calculate their average....
compute average loop
COBOL
Demonstrate ADD, SUBTRACT, MULTIPLY, DIVIDE with all variations....
add subtract multiply divide
COBOL
Use COMPUTE for complex mathematical expressions....
compute compound-interest formula
COBOL
Calculate percentage increase, decrease, and percentage of total....
percentage calculation arithmetic
COBOL
Convert between USD, EUR, GBP, and INR....
currency conversion exchange-rate
COBOL
Calculate simple interest: SI = (P * R * T) / 100...
interest compute financial
COBOL
Handle decimal precision with ROUNDED and overflow with ON SIZE ERROR....
rounded size-error overflow precision
Intermediate
COBOL
Calculate progressive tax: 0-10000: 0%, 10001-30000: 10%, 30001-50000: 20%, Above 50000: 30%....
tax brackets progressive calculation

🔀 Conditional Logic

COBOL
Accept a number and determine if it is positive, negative, or zero....
if-else conditions signed
Beginner
COBOL
Accept marks (0-100) and display grade: A(90+), B(80-89), C(70-79), D(60-69), F(<60)....
evaluate grades conditions
Beginner
COBOL
Demonstrate nested IF statements and ELSE clause....
if else conditional nested
COBOL
Determine if a year is a leap year....
leap-year divisibility date
COBOL
Given three sides, determine triangle type: Equilateral, Isoceles, Scalene, or Invalid....
triangle geometry validation
Intermediate
COBOL
Accept a year and determine if it is a leap year....
leap-year divide remainder
Intermediate
COBOL
Use EVALUATE for multiple condition checking (like switch-case)....
evaluate switch case conditions
COBOL
Use 88-level condition names for readable conditions....
88-level condition-name readable
Intermediate
COBOL
Combine conditions using AND, OR, NOT operators....
and or not complex-conditions

🔄 Loops & PERFORM

COBOL
Use a loop to print numbers from 1 to 10....
perform loop counter
COBOL
Print multiplication table for a given number....
multiplication loop table
Beginner
COBOL
Execute a paragraph a specific number of times....
perform times loop iteration
Beginner
COBOL
Loop until a condition becomes true....
perform until while loop
COBOL
Generate first N Fibonacci numbers....
fibonacci sequence algorithm
COBOL
Print a pyramid pattern of stars for N rows....
pattern pyramid loop stars
Intermediate
COBOL
Calculate factorial of a number (n! = 1*2*3*...*n)....
factorial loop multiply
Intermediate
COBOL
Use PERFORM VARYING for counter-controlled loops....
perform varying for-loop nested
Intermediate
COBOL
Execute a range of paragraphs using PERFORM THRU....
perform thru paragraph sequence
Intermediate
COBOL
Generate all prime numbers up to N....
prime algorithm loop divisibility

📝 String Handling

Beginner
COBOL
Reverse a given string....
string reverse algorithm
Intermediate
COBOL
Accept a string and display it reversed....
string reverse reference-modification
Intermediate
COBOL
Count the number of vowels in a given string....
string inspect vowels
Intermediate
COBOL
Accept 10-digit phone and format as (XXX) XXX-XXXX. Input: 1234567890 -> (123) 456-7890...
string formatting reference-modification
Intermediate
COBOL
Count the number of words in a sentence. Input: "HELLO WORLD COBOL" -> 3 words...
string word-count algorithm
Intermediate
COBOL
Validate if email has proper format: contains @ and . after @....
email validation string
Intermediate
COBOL
Check if a string is a palindrome (same forward and backward)....
palindrome string algorithm
Advanced
COBOL
Parse a comma-separated record into individual fields. Input: "JOHN,DOE,35,NEW YORK"...
unstring csv parsing delimited

📋 Tables & Arrays

COBOL
Create and access a single-dimension table (array)....
table array occurs subscript
Intermediate
COBOL
Create and work with a two-dimensional table....
table 2d matrix nested-occurs
Intermediate
COBOL
Search tables using linear SEARCH and binary SEARCH ALL....
search search-all binary-search indexed
COBOL
Create variable-length table using OCCURS DEPENDING ON....
variable-length depending-on dynamic

📁 File Handling

COBOL
Read two sorted files and merge them into one sorted output file....
file merge sort algorithm
COBOL
Update master file with transactions: A=Add, U=Update, D=Delete. Both files sorted by key....
file master transaction batch
COBOL
Use REPORT WRITER to generate formatted report....
report formatting output
COBOL
Generate report with control breaks (subtotals by group)....
control-break subtotal report

🔗 Subprograms

Intermediate
COBOL
Use COPY to include copybook members....
copy copybook include replacing
Intermediate
COBOL
Call a subprogram and pass parameters....
call subprogram linkage using
COBOL
Understand difference between BY REFERENCE and BY CONTENT....
call reference content value

⚙️ JCL Basics

Beginner
JCL
Write basic JCL to run a program called MYPROG....
job exec basic
JCL
Write JCL that reads from dataset MY.INPUT.FILE....
dd input disp
JCL
Write JCL that creates a new sequential dataset....
dd output dcb
COBOL
Read VSAM KSDS file sequentially....
vsam ksds sequential indexed
Advanced
COBOL
Read VSAM KSDS randomly by key....
vsam ksds random direct-access
COBOL
Add new records and update existing records in KSDS....
vsam write rewrite update

🛠️ JCL Utilities

Beginner
JCL
Copy specific members from one PDS to another....
iebcopy pds copy
Intermediate
JCL
Write JCL to sort a file by employee ID (positions 1-5)....
sort utility
Intermediate
JCL
Write JCL that runs STEP2 only if STEP1 returns RC=0, and STEP3 runs if either step failed....
cond return-code conditional
Intermediate
JCL
Write IDCAMS to delete a VSAM file if it exists, then define a new KSDS....
idcams vsam ksds define
Intermediate
JCL
Sort employee file, include only active employees (status=A in pos 50), sort by department and name....
sort include filter
JCL
Explain all common DD statement parameters....
dd dsn disp space
Intermediate
JCL
Use JOBLIB and STEPLIB for program libraries....
joblib steplib loadlib concatenation
Intermediate
JCL
Use JCLLIB and INCLUDE for procedure libraries....
jcllib include modular library
Advanced
JCL
Write JCL to create a new generation of a GDG and also reference the previous generation....
gdg generation versioning
JCL
Create and call a JCL procedure....
proc procedure symbolic override
JCL
Create job where step execution depends on previous step outcome....
jcl if-then conditional multi-step

🏢 Real-World Scenarios

Intermediate
COBOL
Track deposits and withdrawals, maintain balance, prevent overdraft....
banking transaction validation
Intermediate
COBOL
Validate credit card number using Luhn algorithm. Check: 16 digits, valid checksum, identify card type (Visa/Master/Amex)....
validation luhn credit-card algorithm
Intermediate
COBOL
Calculate: days between two dates, find day of week for any date....
date functions calculation
Intermediate
COBOL
Calculate Equated Monthly Installment (EMI) for a loan....
loan emi finance amortization
COBOL
Calculate gross pay, deductions, and net pay. Regular hours up to 40, overtime at 1.5x....
payroll business calculation
COBOL
Read employee file, calculate tax based on salary slabs, generate formatted salary report. Tax Slabs: 0-25000: 0%, 25001-50000: 10%, 50001-100000: 20%...
payroll report tax evaluate
COBOL
Track product inventory: add stock, sell items, show low stock alerts (below 10 units), generate inventory report....
inventory tables business menu
Advanced
COBOL
Simulate ATM: PIN verification (3 attempts), check balance, withdraw (multiples of 100, max 20000), deposit, mini statement (last 5 transactions)....
atm banking security transactions
Advanced
COBOL
Generate itemized bill: multiple items with quantity and price, apply discount if total > 1000, add GST 18%, print formatted bill....
billing invoice business calculation
COBOL
Manage student records: add students, record marks for 5 subjects, calculate total/average/grade, show class topper....
grades students tables business
COBOL
Process customer orders: validate customer ID, check product availability, calculate total, apply loyalty discount, update inventory....
order ecommerce business validation
COBOL
Generate monthly bank statement: opening balance, all transactions, closing balance, interest calculation....
banking statement running-balance interest
COBOL
Calculate insurance premium based on age, coverage amount, and risk factors....
insurance premium risk calculation
COBOL
Track employee leave: apply leave, approve/reject, show balance, generate leave report....
leave hr employee management
COBOL
Manage patient records: admit, discharge, view details, bill calculation....
hospital patient healthcare billing
COBOL
Manage library: add books, issue, return, check availability, fine calculation....
library books management fine

🐛 Debugging

COBOL
This code has an infinite loop. Find and fix it: PERFORM VARYING WS-I FROM 1 BY 1 UNTIL WS-I = 10 DISPLAY WS-I END...
debugging loop bug-fix
COBOL
Result shows wrong value: 01 WS-PRICE PIC 99V99 VALUE 12.50. 01 WS-QTY PIC 99 VALUE 5. 01 WS-TOTAL PIC 99V99. M...
debugging decimal truncation
COBOL
Result is wrong: 01 WS-A PIC 9(3) VALUE 999. 01 WS-B PIC 9(3) VALUE 999. 01 WS-C PIC 9(3). ADD WS-A TO WS-B GIVING WS-C....
debugging truncation overflow
COBOL
Loop executes wrong number of times: PERFORM VARYING WS-I FROM 1 BY 1 UNTIL WS-I = 10 DISPLAY WS-I END-PERFORM....
debugging perform loop boundary
Intermediate
COBOL
Why does this show 0 instead of 150? 01 WS-A PIC 99 VALUE 15. 01 WS-B PIC 99 VALUE 10. 01 WS-C PIC 99. MULTIPLY WS-A BY WS...
debugging truncation pic
Intermediate
COBOL
This code causes S0C7 (data exception). Find the bug: 01 WS-NUM PIC 9(5). MOVE SPACES TO WS-NUM. ADD 1 TO WS-NUM....
debugging s0c7 abend
COBOL
This code causes S0C4. Find the bug: 01 WS-TABLE. 05 WS-ITEM PIC X(10) OCCURS 10 TIMES. 01 WS-IDX PIC 99 VALUE 0. PERFO...
debugging s0c4 subscript table
Intermediate
COBOL
File READ fails silently. Find why: READ INPUT-FILE INTO WS-RECORD. DISPLAY WS-RECORD....
debugging file-status error-handling
Intermediate
COBOL
This code runs forever. Find and fix the bug: PERFORM UNTIL WS-I > 10 DISPLAY WS-I END-PERFORM....
debugging infinite-loop perform
Intermediate
COBOL
Negative number displays wrong: 01 WS-BAL PIC 9(5) VALUE 0. SUBTRACT 100 FROM WS-BAL....
debugging sign negative
Intermediate
COBOL
STRING produces truncated result: 01 WS-RESULT PIC X(10). STRING "HELLO" " " "WORLD" INTO WS-RESULT....
debugging string overflow
Intermediate
COBOL
SEARCH never finds existing item: SET IDX TO 1. SEARCH WS-TABLE AT END DISPLAY "NOT FOUND"....
debugging search table when