Used to force failure of a field edit.
Syntax |
|
Parameters |
|
- message
Specifies a custom error message.
Discussion |
|
When this statement is executed, it forces data entered in
the current field to fail any specified edits. When FAIL is executed, an error flag is set for the field.
If you include the message parameter, that message is issued; otherwise,
a system message is issued.
A FAIL statement is normally used in an IF statement where it is executed conditionally.
Example |
|
For example, suppose you want to ensure that an entered value
is in a table of values. You can use the FAIL statement to ensure that no further edits are
performed and an error message issued if the value is no found.
IF NIN $STATE THEN SET TO $EMPTY FAIL "Must enter legitimate state code"
|
If the value is found in the table, the FAIL statement is not performed nor is the field cleared
to blank.