Checks the status returned by a command and either continues processing or branches to the associated label in response to the status.
Syntax
IFERROR "Label"; <SKIPPED COMMANDS> :Label ; <COMMANDS OR EOF>
Parameter | Description |
---|---|
"Label" | String of characters terminated by a whitespace; not case-sensitive. |
:Label | Target location, preceded by a colon (:), and associated with "Label". Processing skips to this label. |
Notes
This command provides the functionality of error checking and conditional branching on errors.
If the previously executed command returned a nonzero status, processing skips all subsequent commands and moves to the associated label, where it resumes. Commands that follow :Label can implement error handling or stop processing.
Processing ignores even the EXIT command if it precedes :Label. If EOF occurs before :Label is found, processing terminates.
Example
LOGIN "IRIS" "SYS" "PASSWORD"; SELECT "DANI" "TEST"; BUILDDIM 2 "NEWGENS.RUL" 2 "NEWGENS.TXT" 4 "REJREC.ERR"; IFERROR "DIMBUILDFAILED"; /* If BUILDDIM fails */ LOADDATA 2 "JANACT.TXT"; /* Skip LOADDATA */ :DIMBUILDFAILED; /* Move here */ EXIT; /* and exit */