CUCO study materials
CUCO study resources

CUCO: Debugging, Testing, and Maintenance

CUCO · Work through your exam, one topic at a time.

All guide sections

Debugging, Testing, and Maintenance

This domain tests how you find and fix defects: compiler options, runtime abend diagnosis, test-data design, and safe maintenance of working code. Items often present a failure symptom and ask for the most likely cause or the option that would have caught it.

Compiler-side tools

SSRANGE inserts subscript-range checks; OFFSET produces a statement offset table for matching abends to source lines; TEST enables the debugger; LIST, MAP and XREF produce listings, maps and cross-references. TRUNC controls binary truncation, NUMPROC controls sign handling, and OPTIMIZE changes code generation and can hide variables from a debugger. COPY REPLACING expands copybooks at compile time, so a change to a copybook affects every program that copies it.

Runtime diagnosis

S0C7 is a data exception, usually an invalid numeric field such as spaces or LOW-VALUES in a COMP-3 item. S0C4 is a protection exception, often a bad address from a subscript, pointer or parameter. DISPLAY output, file status checks, and USE FOR DEBUGGING declaratives with DEBUG-ITEM help localize the failure when a debugger is unavailable. WITH DEBUGGING compiles debugging lines marked with D in column 7; EXHIBIT and READY TRACE are compiler-specific tracing aids.

Testing and maintenance

Test with invalid and boundary data, not only valid records: empty files, short records, duplicate keys, zero and negative values, and maximum table sizes. Keep regression tests of expected output before changing code. When modifying a program, check every PERFORM THRU range, every shared copybook, and every CALL parameter layout, because these changes ripple beyond the edited line.

Worked example. A nightly job abends with S0C7 on a COMPUTE that adds a packed field. The offset table points to the statement; the dump shows the packed field contains X'40' bytes because the input record was shorter than the FD layout and the remainder was space-filled. The fix is to validate record length and test the field with IS NUMERIC before arithmetic, and to check FILE STATUS after the READ.

Traps

  • Testing only happy-path data so S0C7 and status 23 paths never run.
  • Relying on SSRANGE in production; it may be compiled off for performance.
  • Debugging optimized code and seeing stale or missing variables.
  • Changing a copybook without recompiling every dependent program.
  • Using COPY REPLACING on a partial word and corrupting unrelated names.