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

🐛 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