Errors During Input and Output

REXX offers considerable flexibility in the handling of errors during input or output. This is provided in the form of a NOTREADY condition, which CALL ON and SIGNAL ON instructions can trap, and by the STREAM function, which can elicit further information. (See Conditions and Condition Traps for a more detailed discussion of SIGNAL ON and CALL ON.)

When an error occurs during an input or output operation, the function being called continues without interruption (for example, an output function returns a nonzero count). Depending on the nature of the operation, a program has the option of raising the NOTREADY condition. The NOTREADY condition is similar to the ERROR and FAILURE conditions associated with commands in that it does not cause a terminating error if the condition is raised but is not trapped.

After NOTREADY has been raised, the following possibilities exist:

After the NOTREADY condition has been raised and is in DELAY state, the CONDITION function (with the Description option) returns the name of the stream being processed when the stream error occurred. If the stream is a default stream and has no defined name, then the null string is returned.

The STREAM function then shows that the state of the stream is ERROR or NOTREADY, and you can get additional information on the state of the stream by specifying the Description option on the STREAM function.