ICETOOL Return Codes and MODE

ICETOOL sets a return code for each operator it runs and then sets the step return code to the highest of those. So if one operator returns 4 and another returns 16, the step return code is 16. You can use this in JCL to conditionally run later steps (e.g. only if return code is 0). The MODE operator controls what ICETOOL does when an operator fails: STOP (stop processing), CONTINUE (run the next operator anyway), or SCAN. This page explains the common return codes and how to use MODE for error handling.

Control Statements (Core Syntax)
Progress0 of 0 lessons

Step Return Code

ICETOOL runs each operator in order. Each operator (COPY, SORT, COUNT, etc.) returns a return code. ICETOOL keeps the maximum return code and sets the step return code to that value. So one failure (e.g. 16) makes the whole step fail even if earlier or later operators succeeded (0 or 4).

Common Return Codes

ICETOOL return codes (typical)
Return codeMeaning
0Success; no errors.
4Success with DFSORT warning (e.g. truncation, warning condition).
8Unsuccessful; e.g. COUNT operator found criteria met when RC8 was specified.
12Unsuccessful; ICETOOL or DFSORT error, or COUNT criteria met when RC12.
16DFSORT detected one or more errors during the operation. Check DFSMSG.
20Message dataset error: TOOLMSG missing or not opened.
24Unsupported operating system.

MODE Operator

MODE controls behavior when an operator returns a non-zero return code:

  • STOP — Stop processing. No further operators run. This is often the default.
  • CONTINUE — Continue with the next operator even if the current one failed. Use when you want all operations attempted and the step return code to reflect the worst result.
  • SCAN — Continue in a way that may still process or scan remaining operators; exact behavior is product-dependent. Check your manual.
text
1
2
3
COUNT FROM(INDD) USING(CTL1) MODE CONTINUE SORT FROM(INDD) TO(OUTDD) USING(CTL2)

Here if COUNT fails, ICETOOL still runs SORT. The step return code is the higher of the two operators’ return codes.

Using Return Codes in JCL

You can use the step return code in conditional execution. For example run a backup step only if ICETOOL succeeded (RC 0 or 4), or run an error-handling step only if RC > 4. Syntax is site-dependent (COND on EXEC, or IF/THEN/ELSE in JCL).

Explain It Like I'm Five

Imagine you have a list of three chores. Each chore can end with “done” (0), “done but with a small warning” (4), or “failed” (16). The step’s overall result is the worst outcome: if any chore failed, the whole step is “failed.” MODE STOP means “stop doing chores as soon as one fails.” MODE CONTINUE means “try all three chores no matter what; at the end we’ll still say the step failed if any chore failed.”

Exercises

  1. If COPY returns 0 and SORT returns 16, what is the step return code?
  2. When would you use MODE CONTINUE instead of the default?
  3. What should you check first if the step return code is 20?

Quiz

Test Your Knowledge

1. What does ICETOOL set as the step return code when multiple operators run?

  • The return code of the first operator
  • The return code of the last operator
  • The highest return code from any operator in the step
  • Always 0

2. What does MODE CONTINUE do?

  • Continues sorting
  • Tells ICETOOL to continue with the next operator even if the current operator returns a non-zero return code
  • Only for COPY
  • Resets the return code to 0

3. Return code 20 from ICETOOL usually indicates what?

  • Sort error
  • TOOLMSG DD was missing or could not be opened—message dataset error
  • Invalid data
  • End of file

4. When would you use MODE STOP (default)?

  • When you want to run only one operator
  • When you want the step to stop as soon as any operator fails—no further operators run
  • Only for SORT
  • When you want to ignore errors

5. What does return code 16 indicate?

  • Success with warnings
  • DFSORT detected one or more errors during the operation
  • ICETOOL syntax error
  • Missing TOOLIN