A record selection expression is used to select a record in the database. It can be used in a FETCH or FIND statement. The record thus selected becomes the current record of the run unit upon which subsequent statements may operate when accessing the database.
1 – 1format_database_key_identifier_access
This format selects a record by a database key value held by the Database Control System (DBCS) in a currency indicator or a keeplist entry. Format 1 - Database Key Identifier Access database-key-identifier
1.1 – database-key-identifier
identifies a record according to the rules of Database Key Identifiers.
2 – 2format_set_owner_access
This format selects the record that owns a set. Format 2 - Set Owner Access OWNER WITHIN set-name
2.1 – set-name
is a subschema set name. The Database Control System (DBCS) uses the currency indicator for set-name to choose the owner record of that set occurrence. A database exception condition occurs if set-name is a singular set (DB-CONDITION is set to DBM$_SINGTYP) or if the currency indicator for the set type is null (DB-CONDITION is set to DBM$_CSTYP_NULL).
3 – 3format_record_search_access
This format selects a record by its position within a collection of records and optionally by its record type and contents. Format 3 - Record Search Access { FIRST } { LAST } { NEXT } { PRIOR } { ANY } { DUPLICATE } { [ RELATIVE ] int-exp } [record-name] [ WITHIN { realm-name } ] [ USING { rec-key } ... ] [ { set-name } ] [ WHERE { bool-expres } ]
3.1 – int-exp
is an integer or arithmetic expression resulting in a longword integer value. It cannot be zero.
3.2 – realm-name
is a subschema realm name.
3.3 – record-name
is a subschema record name.
3.4 – set-name
is a subschema set name.
3.5 – rec-key
is a key data item within the subschema record occurrence. The same rec-key can appear only once in a given USING phrase.
3.6 – bool-expres
is a conditional expression that involves data items of the object record. It is used to specify additional requirements of a qualifying record. bool-expres: { bool-alt [ OR bool-alt ] ... } bool-alt: { simp-bool-rel [ AND simp-bool-rel ] ... } simp-bool-rel: { bool-condit } { NOT bool-expres } bool-condit: { { {[ NOT ] EQUAL TO } } } { { {[ NOT ] = } } } { { {[ NOT ] LESS THAN } } } { { IS {[ NOT ] < } } } { { {[ NOT ] GREATER THAN } } } { { {[ NOT ] > } } } { { id } { { GREATER THAN OR EQUAL TO } } { id } } { { lit } { { >= } } { lit } } { { { LESS THAN OR EQUAL TO } } } { { { <= } } } { { DOES {[ NOT ] CONTAIN } } } { { {[ NOT ] CONTAINS } } } { { {[ NOT ] MATCH } } } { { {[ NOT ] MATCHES } } }
3.6.1 – bool-alt
is one or more sub-expressions (simp-bool-rel). Pairs of sub-expressions are joined by the logical operator AND.
3.6.2 – simp-bool-rel
is a simple-condition (bool-condit), an expression, or the negation of either.
3.6.3 – bool-condit
a simple-condition is a relation involving two operands joined by a relational operator. At least one operand in each relation must be an item in the record being found or fetched.
4 – 4format_database_key_access
This format selects the record that is referred to by the database key value contained in the special register DB-KEY. Format 4 - Database Key Access DBKEY