SELECT/VERIFY Condition

The SELECT and VERIFY conditions control which data set records are accessed using the remap. The SELECT condition controls which records are retrieved, and the VERIFY condition controls which records are stored.

The following diagram illustrates the syntax for the SELECT and VERIFY conditions:

<SELECT/VERIFY condition>

  ┌◄────────────────── , ─────────────────┐
──┴─┬─/1\─ SELECT <Boolean expression> ─┬─┴────────────────────────────┤
    └─/1\─ VERIFY <Boolean expression> ─┘

The following table explains the elements of the syntax diagram:

Option

Description

SELECT

The SELECT condition is applied when a user program attempts to find or lock a record using the remap. (However, the SELECT condition is not applied when attempting only a FIND KEY OF operation using the remap. Thus, key or key data items for spanning sets of a remap are not protected by a SELECT condition when the set is invoked and these items are included in the remap record.)

Only data set records that satisfy the SELECT condition are returned to the user. When SELECT is specified, the remap can appear to have substantially fewer records than does the data set. If a record is found which does not satisfy the SELECT condition, the Accessroutines automatically bypasses the record and attempts to locate a record which meets the SELECT condition. If no record satisfies the SELECT condition, a NOT FOUND exception is returned to the user program.

The value of any data item within the remap can be tested using the SELECT condition.

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

VERIFY

The VERIFY condition operates for remaps exactly as it does for data sets. Each time a record is stored using the remap, the VERIFY condition is applied. If the condition is not satisfied, the record is not stored and the user program is notified of the error.

When VERIFY conditions are specified for both the data set and the remap, both conditions must be satisfied before the record is stored using the remap. If either condition is not satisfied, the record is not stored and an exception is returned to the user program performing the store operation.

SELECT and VERIFY

When both SELECT and VERIFY are specified, the conditions should be compatible. Otherwise, it is possible to find records which cannot be stored.

Example

There are two SELECT/VERIFY conditions in this example. The first selects records where X is greater than 0 (zero) and verifies that X is less than 100; the second verifies that X is greater than 0 (zero) and less than 100.

D DATA SET
 (
  A ALPHA(5);
  B BOOLEAN;
  N NUMBER(S5,2);
  P REAL;
 ) VERIFY P GEQ 0;
R REMAPS D
 (
  A;
  X = N;
  P;
 ) SELECT X > 0 AND X < 100,
   VERIFY X > 0 AND X < 100;