The IFERR operation can be used within program execution context to control the flow of execution through the program. It is combined with the THEN, END and possibly the ELSE operation to form a IFERR control structure.
The normal way IFERR is used is one of the following:
≪ ... IFERR ... operations ... THEN ... operations ... END ... ≫
or
≪ ... IFERR ... operations ... THEN ... operations ... ELSE ... operations ... END ... ≫
During execution, the operations between IFERR and THEN are executed. If in the course of executing those operations an error is raised, then execution will then jump to the operations following THEN, skipping past any other operations between IFERR and THEN. At this point, your program can attempt to handle the error which occurred. After executing the THEN block of operations, an optional block of ELSE operations will be skipped and execution will continue after the END operation.
If no error occurs during the execution of the operations between IFERR and THEN, then execution will jump to the optional ELSE block if present or just continue after END if no ELSE is present.
Note that if an operation raises as error during normal program execution, execution will stop and not be restartable. One common use for IFERR might be to do something like:
≪ ... IFERR ... operations ... THEN HALT END ... ≫
This allows you to suspend the execution of the program when an error occurs. Note that if you continue execution, it continues from the HALT operation and does not retry the operations which were skipped between IFERR and THEN. You need to manually run those operations before continuing.
An error will be raised if this operation is used outside of program execution context.