validate Statement--Validate Fields
This statement performs the field validation checks specified in VIFRED.
Syntax
validate [field fieldname]
Description
The validate statement performs validation checks on a specified field or on all fields on a form. (For a description of validation checks, see Field Validation in
Table Fields.) If one or more fields fail a check, Ingres displays an error message, the application breaks out of the operation currently in progress, and the cursor is positioned on the first field that failed the check. If all the indicated fields pass the validation check, execution continues with the next statement.
When you execute this statement, the FRS performs the validation check immediately, independent of any user action. In contrast, the set_frs statement directs the FRS to perform the check when the user performs some specified action, such as pressing the Menu key.
If you omit the field fieldname clause, the FRS validates all fields and datatypes on the current form that have a validation check specified in VIFRED. The cursor is returned to the first invalid field, if any.
If you do specify a particular field, only that field is checked. The fieldname can identify a simple field or a table field. For table fields, the FRS validates the data in all of the displayed rows. (Data in unseen rows is automatically validated when the rows are scrolled out of the display.) The FRS does not validate data in hidden columns.
To validate only a single displayed row, use the validrow statement.
You can specify fieldname as a character string, with or without quotes, or as a program variable.
The validate statement must be syntactically within a display block, as it generates a local goto statement to the beginning of the block.
Examples--validate statement:
Example 1:
Validate the data in the field sal before getting the value.
exec frs validate field sal;
exec frs getform empform (:salvar = sal);
Example 2:
Validate the data in the field indicated by the program variable fieldvar.
exec frs validate field :fieldvar;
Example 3:
Validate the displayed rows of the employee table field before unloading its data set.
exec frs validate field employee;
exec frs unloadtable empform employee
(:ename = ename, :age = age, :eno = eno);
exec frs begin;
process the row;
exec frs end;