Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Error handling

&pagelevel(3)&pagelevel

In contrast to non-S procedures, S procedures permit selective error handling for
commands and program statements. Since SDF-P interprets return codes from statements as return codes from commands, no distinction is made between the two types of return codes in the following sections (see also the description of the BEGIN-BLOCK command). SDF-P provides commands for this purpose that react to an error situation or can be used to analyze an error. In addition, there are functions that support error handling (see chapter“Functions”).

Error handling in S procedures is block-oriented, i.e. it is performed on block level. In the case of blocks nested inside one another, error handling can be performed on each level. However, it can be called for higher, surrounding blocks only. The errors that occur in inside blocks are then also transferred and processed.

The error handling of individual commands is a special case in block-oriented error handling. In this case, the command is set internally in a BEGIN block.

Error handling itself is performed in error handling blocks. A distinction must be made between two such error handling blocks:

  • IF-BLOCK-ERROR

  • IF-CMD-ERROR

SDF-P also supports error analysis on the command return code level (with the SAVE-RETURNCODE command and predefined functions).

For the sake of compatibility with non-S procedures, SDF-P still supports the SET-JOB-STEP command.

Note

The following commands are not executed if an error occurs:
ABEND, ABORT, CANCEL-PROCEDURE, END-PROCEDURE, ENDP, EXIT-JOB, EXIT-PROCEDURE, LOGOFF.

When an error occurs, the components of the return code can be queried using the built-in functions (see chapter “Functions”). If the return code is to be checked even when an error has not occurred, the SAVE-RETURNCODE command must first be called. Only then will the return code be made available for evaluation by means of the predefined functions.

Error handling is automatically activated when command execution returns a return code with an error indication. SDF-P then branches to the next IF–BLOCK-ERROR or IF–CMD-ERROR command.

SAVE-RETURNCODE

The SAVE-RETURNCODE command is used to save the current return code. The return code can then be evaluated by means of the predefined functions. Thus, for example, the programmer can react to situations in which command execution was terminated without error (subcode1 = 0) but subcode2 and the maincode must be evaluated.