Technical data
3. If you use neither WITHIN realm-name nor WITHIN set-name, all records
defined in the subschema make up the object collection. The object currency
indicator defaults to the currency indicator for the run unit. The ordering of
the object collection is unspecified.
Qualification Clause
Use record-name to restrict the search to records of a particular type. If you do
not use record-name, the DBCS searches each record type in the subschema.
You can further restrict the search to records with specific data item values.
You do this by specifying the qualification clause. The qualification clause is
either the reserved word USING followed by one or more rec-keys, or the reserved
word WHERE followed by a Boolean expression. When USING is specified, the
DBCS searches for only those database records whose key data items equal the
corresponding data items in your user work area. When WHERE is specified, the
DBCS searches for database records of the object record type whose item values
cause the Boolean expression to evaluate to true.
The qualification clause optionally specifies the following additional rules for
determining the object record type, the qualifying record, and the key data item:
1. If record-name is used, its record type is called the object record type.
2. Rec-key must be a data item defined in the subschema database record type,
record-name.
3. If the key data item consists of one or more rec-keys, it describes additional
criteria for selecting a record.
4. If the USING clause is used, a qualifying record is an occurrence of the object
record whose corresponding variables in the user work area (UWA) equal the
contents of the key data item.
5. If the WHERE clause is used, each occurrence of the object record type for
which the bool-expression is true is called a qualifying record.
6. If you do not use the qualification clause, each occurrence of record-name,
regardless of its contents, is called the qualifying record.
7. At least one operand in every relation condition of a WHERE Boolean
expression must be an elementary item in the record being found or fetched.
Position Clause
The reserved words FIRST, LAST, NEXT, PRIOR, ANY, DUPLICATE, and
RELATIVE make up the position clause. The position clause selects a specific
qualifying record in the object collection. The position clause rules follow:
1. Int-exp refers to an embedded integer literal or to an integer variable. Int-
exp can be either an integer or an arithmetic expression. Both result in a
longword integer value. Int-exp cannot be zero.
2. ANY is equivalent to FIRST.
3. DUPLICATE is equivalent to NEXT.
4. Using the FIRST clause is equivalent to assigning +1 to int-exp. It refers to
the first record in the object collection.
5. Using the LAST clause is equivalent to assigning –1 to int-exp. It refers to
the last record in the object collection.
6. Using the NEXT clause is equivalent to using RELATIVE +1. It refers to the
record in the object collection immediately after the current position.
Procedure Division 4–13