When the KEY phrase is specified, the key data item used for the comparison is data-name.
When the KEY phrase is not specified, the file position indicator is set to the record with a key equal to the value contained in the RECORD KEY data item.
When START statement execution is successful, the RECORD KEY or ALTERNATE RECORD KEY with which data-name-1 is associated becomes the key of reference for subsequent READ statements.
When the KEY phrase is specified, the search argument used for the comparison is data-name-1, which can be:
This data item can be qualified or reference modified. If the key itself is not used, the leftmost character position plus the reference modification starting position must correspond to the leftmost character position of the key field.
The file position indicator is positioned to the first record in the file with a record key for a format that satisfies the comparison. If the operands in the comparison are of unequal length, the comparison proceeds as if the longer field were truncated on the right to the length of the shorter field. All other numeric and nonnumeric comparison rules apply, except that the PROGRAM COLLATING SEQUENCE, if specified, has no effect.
+-------------------------------IBM Extension--------------------------------+
For a file that specified RECORD KEY IS EXTERNALLY-DESCRIBED-KEY, the following additional considerations apply:
Table 33. Relationship between KEY IS and FORMAT Phrases
| FORMAT Phrase specified | KEY Phrase | ||
|---|---|---|---|
| Data-Name Series | Omitted | EXTERNALLY-DESCRIBED-KEY | |
| Yes | A, B | C, D | C, B |
| No | A, E | F, G | F, E |
+----------------------------End of IBM Extension----------------------------+
When the KEY phrase is not specified, the key data item used for the EQUAL TO comparison is the prime RECORD KEY.
The file position indicator points to the first record in the file whose key field satisfies the comparison. If the operands in the comparison are of unequal lengths, the comparison proceeds as if the longer field were truncated on the right to the length of the shorter field. All other numeric and nonnumeric comparison rules apply, except that the PROGRAM COLLATING SEQUENCE clause, if specified, has no effect.
When START statement execution is successful, the RECORD KEY with which data-name-1 is associated becomes the key of reference for subsequent READ statements.
When START statement execution is unsuccessful, the key of reference is undefined.
+-------------------------------IBM Extension--------------------------------+
For indexed files of device type DATABASE, the meaning of the comparison
can be affected by the type of key fields in the record area defined for the
file. Key fields on this system can be defined as multiple fields, each
of which can be in ascending or descending sequence. The system
establishes a sequence (keyed sequence access path) for the records based on
the values contained in the record key for the format and the sequencing
specified in DDS. When a START statement is processed, the request is
interpreted as follows:
| COBOL Comparison | System Result |
|---|---|
| GREATER THAN | AFTER |
| NOT LESS THAN | EQUAL TO or AFTER |
For example, when a statement is processed using the comparison of GREATER THAN, a search is made of these sequenced records for the first record after the search argument specified by the START statement. If the file was sequenced using descending keys, the file position indicator would point to a record with a key less than the one specified and not greater than that specified in the START statement.
+----------------------------End of IBM Extension----------------------------+
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.