Verify Condition

A verify condition is used to ensure that only valid records are stored in the database. Each time a user program attempts to store a record, the verify condition is applied. If the verify condition is not satisfied, the record is not stored and the user program is notified of the error. Verify items that are numeric are also validated so that they cannot contain high values, such as all Fs. This is done regardless of the NULL value specified and the condition specified in the verify clause.

One verify condition can be specified for a fixed-format record. It can examine the value of any item in the record.

When a variable-format record is described, a verify condition can be specified for the fixed part, and separate verify conditions can be specified for each variable part. The verify condition for the fixed part can refer only to items in the fixed part. The verify condition for the variable part can refer to items in both the fixed part and the variable part to which the verify condition is attached. If separate verify conditions are specified for the fixed and variable parts, then both must be satisfied before the record is stored.

The following diagram illustrates the syntax for the verify condition in a record description:

<verify condition>

── VERIFY ──<Boolean expression>───────────────────────────────────────┤

The following examples illustrate the DASDL syntax for verify conditions in record descriptions.

Example 1

This verify condition ensures that the values for salary are less than 25,000, and the number of dependents is less than 15.

PAYROLL DATA SET
 (
  NAME            ALPHA(20);
  SALARY          NUMBER(7,2);
  DEPENDENTS      NUMBER(2);
 )
  VERIFY SALARY < 25000 AND DEPENDENTS < 15;

Example 2

In this example, verify conditions are placed on the fixed-format elements and on the variable-format elements of the data set.

 F DATA SET
  (
  A ALPHA(3) REQUIRED;
  N NUMBER(5,2);
  T RECORD TYPE(4);
  ) VERIFY N > 1.0 AND A NEQ "   ",
1: (
  A1 ALPHA(10);
  R1 REAL;
  ) VERIFY R1 > 1 AND R1 < 100,
2: (
   A2 ALPHA(12);
   B2 BOOLEAN;
   N2 NUMBER(4,1);
  ) VERIFY (B2 AND N2 > 5) OR (NOT B2 AND N2 < 5),
4: (
   A4 ALPHA(5);
   R4 REAL;
  ) VERIFY N + R4 NEQ 0;