09.12.2012 Views

Basic Characteristics RAPID

Basic Characteristics RAPID

Basic Characteristics RAPID

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

RETRY Restarts following an error<br />

Example<br />

RETRY is used to restart program execution after an error has occurred.<br />

reg2 := reg3/reg4;<br />

.<br />

ERROR<br />

IF ERRNO = ERR_DIVZERO THEN<br />

reg4 := 1;<br />

RETRY;<br />

ENDIF<br />

Program execution<br />

Error handling<br />

Limitations<br />

Syntax<br />

An attempt is made to divide reg3 by reg4. If reg4 is equal to 0 (division by zero),<br />

a jump is made to the error handler, which initialises reg4. The RETRY instruction<br />

is then used to jump from the error handler and another attempt is made to<br />

complete the division.<br />

Program execution continues with (re-executes) the instruction that caused the error.<br />

If the maximum number of retries (5) is exceeded, the system variable ERRNO is set<br />

to ERR_EXCRTYMAX (see "Data types - errnum"). This error can be handled in the<br />

error handler.<br />

The instruction can only exist in a routine’s error handler. If the error was created using<br />

a RAISE instruction, program execution cannot be restarted with a RETRY instruction,<br />

then the instruction TRYNEXT should be used.<br />

RETRY ’;’<br />

<strong>RAPID</strong> Reference Manual 8-RETRY-1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!