Your Browser is not longer supported

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

{{viewport.spaceProperty.prod}}

IF-BLOCK-ERROR Initiate block error handling

&pagelevel(4)&pagelevel

Domain: PROCEDURE

Command description

IF-BLOCK-ERROR initiates a command sequence which is executed in the following instances:

  • if an error occurred in the current block

  • if an error occurred in a block nested in the current block and was not intercepted before leaving this nested block.

An ELSE branch can be defined in the IF-BLOCK-ERROR block, using the ELSE command. The IF-BLOCK-ERROR block is terminated with the END-IF command.

If the IF-BLOCK-ERROR command is called even though an error did not occur, the ELSE branch is executed - if present - or command execution resumed after the related END-IF command. If the command return code is to be evaluated when no error has occurred, either in the ELSE branch or after the END-IF command, a SAVE-RETURNCODE command must be entered before the IF-BLOCK-ERROR command.

Format

IF-BLOCK-ERROR


Command return codes

(SC2)

SC1

Maincode

Meaning


0CMD0001No error

1CMD0202Syntax error

1SDP0118Command in false context

1SDP0223Incorrect environment

3CMD2203Incorrect syntax file

32CMD0221System error (internal error)

130SDP0099No further address space available

Example

/BL1: BEGIN-BLOCK
/...
/    BL2: BEGIN-BLOCK
/    ...
/    “Error 1 occurs here”
/    ...
/    END-BLOCK BLOCK = BL2
/...
/“Error 2 occurs here”
/...
/IF-BLOCK-ERROR ... “The error is intercepted here”
/...
/END-IF
/END-BLOCK BLOCK = BL1

Block BL2 is nested in block BL1. Error handling is not carried out in block BL2.
Errors that occur in block BL2 are intercepted by block BL1 in the IF-BLOCK-ERROR block just like errors that occur in Block BL1.