COMPILE.CONSTRAINTS

Top  Previous  Next

 

The COMPILE.CONSTRAINTS command is used to compile data integrity constraints.

 

 

Format

 

COMPILE.CONSTRAINTS file.name

COMPILE.CONSTRAINTS file.name,subfile.name

COMPILE.CONSTRAINTS file.name,*

 

COMPILE.CONSTRAINTS file.name {CLEAR} {DISABLE | LOGGING}

 

where

 

file.nameis the name of the file for which data integrity constraints are to be compiled. This must correspond to a VOC F-type record.

 

subfile.nameis the name of the subfile if file.name references a multi-file. Use of an asterisk as the subfile name compiles the constraints into all subfiles.

 

CLEARcauses the command to remove the compiled constraint definitions, leaving the source form in place. This qualifier can be used with all three of the file name formats.

 

DISABLEcauses validation at the point of writing to the file to be suppressed. Records that would have failed validation can be identified later using the VERIFY.CONSTRAINTS command.

 

LOGGINGcauses a validation error to be recorded in the error log but allows faulty data to be written.

 

 

The data integrity constraint rules are defined in field 12 of D, A or S-type records in the dictionary and must be compiled and stored in the data file before they take effect. This is done using the COMPILE.CONSTRAINTS command.

 

For each field to which constraints are to be applied, the command shows the field number (0 for the record id), field name and constraints expression. If an error occurs, no updates are applied to the data files.

 

Where a field is defined from multiple dictionary records, only one may contain a constraints expression.

 

On completion of the command, @SYSTEM.RETURN.CODE will be zero if compilation was successful or a negative error number if it fails.

 

 

See also:

Data integrity constraints, VERIFY.CONSTRAINTS