Domain: PROCEDURE
Command description
IF-CMD-ERROR initiates a command sequence which is executed when an error occurs in the directly preceding command. This permits specific error handling for this command, thus avoiding block error handling.
IF-CMD-ERROR is ignored after the following commands:
IF / END-IF
FOR
WHILE
REPEAT
BEGIN-BLOCK
GOTO
CYCLE
EXIT-BLOCK
The ELSE command can be used in the IF-CMD-ERROR block to define an ELSE branch. In addition, a SAVE-RETURNCODE command is executed implicitly in the ELSE branch, which means that the latest return code from the command is available even if the
command was executed without errors. The IF-CMD-ERROR block is terminated with the END-IF command.
If IF-CMD-ERROR is called even though an error did not occur, the ELSE branch is executed - if present - or command execution resumed after the corresponding END-IF.
Format
IF-CMD-ERROR |
Command return codes
(SC2) | SC1 | Maincode | Meaning |
0 | CMD0001 | No error | |
1 | CMD0202 | Syntax error | |
1 | SDP0118 | Command in false context | |
1 | SDP0223 | Incorrect environment | |
3 | CMD2203 | Incorrect syntax file | |
32 | CMD0221 | System error (internal error) | |
130 | SDP0099 | No further address space available |
Example
Note
The command preceding IF-CMD-ERROR and the IF-CMD-ERROR block effectively form a BEGIN block.