VALIDATE statement

Verifies that a record complies with mandatory field and unique index definitions.

Syntax

VALIDATE record [ NO-ERROR ]
record

The name of the record you want to validate.

To validate a record in a table defined for multiple databases, you must qualify the record's table name with the database name. See the record definition in the Record phrase reference entry for more information.

NO-ERROR
The NO-ERROR option is used to prevent the statement from raising ERROR and displaying error messages.

Example

This procedure prompts for an item number. If an Item with that number is not available, the procedure creates a new Item record and lets you supply some Item information. The VALIDATE statement checks the data you enter against the index and mandatory field criteria for the Item record.

r-valid.p

REPEAT FOR Item:
  PROMPT-FOR Item.ItemNum.
  FIND Item USING Item.ItemNum NO-ERROR.
  IF NOT AVAILABLE Item THEN DO:
    CREATE iIem.
    ASSIGN Item.ItemNum.
    UPDATE Item.ItemName Item.Price.
    VALIDATE Item.
  END.
  ELSE 
    DISPLAY Item.ItemName Item.Price.
END.

Notes

See also

IF...THEN...ELSE statement, NO-ERROR option