VALIDATE() |
|
|
The VALIDATE() function validates a record against data integrity constraints.
Format
VALIDATE(fvar, id, data)
where
The VALIDATE() function allows an application to test whether the record in data satisfies the validation rules for the file open to fvar. If successful, the function returns True. Using VALIDATE() against a hashed file that has no constraints defined will also return True.
If the validation fails, VALIDATE() returns False and the STATUS() function can be used to determine why it failed. A status of zero indicates that the constraints rules were not met. The failing field number will be in @FNO and the corresponding field name will be in @FNAME. A non-zero status value indicates that some other error occurred such as the file being of an inappropriate type.
Example
The processing performed by the VERIFY.CONSTRAINTS command is essentially as below: LOOP READNEXT ID FROM ID.LIST ELSE EXIT READ REC FROM DATA.F, ID THEN IF NOT(VALIDATE(DATA.F, ID, REC)) THEN DISPLAY ID : ' (FIELD ' : @FNO ; ')' END END REPEAT
See also: |