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

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

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

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

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

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

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

📋 Tables & Arrays

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

🔗 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

⚙️ JCL Basics

JCL
Write JCL that creates a new sequential dataset....
dd output dcb

🛠️ JCL Utilities

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

🏢 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

🐛 Debugging

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