COBOL Manual for TNS and TNS/R Programs

Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs522555-006
9-184
READ for Sequential or Dynamic Access
Retrieval
When the file position indicator has a value that permits positioning for the read
operation, the run-time routines use that value to identify the record to be retrieved.
In this topic, if the value of the file position indicator reflects a current key of
reference that is a record key, the comparisons relate to the value of that key for
records in the file; otherwise, the comparisons for a sequential file relate to the
record number of the records in the file, and the comparisons for a relative file
relate to the relative record number of the records in the file.
If the file position indicator was established by a previous OPEN or START
statement, then the record selected for retrieval is one of:
°
If NEXT is specified or implied, the record whose record number or key value is
greater than or equal to the file position indicator
°
If REVERSED is specified, the record whose record number or key value is
less than or equal to the file position indicator
If the file position indicator was established by an earlier READ statement, and its
setting does not reflect an alternate record key for which duplicates are allowed,
then the record selected for retrieval is one of:
°
If NEXT is specified or implied, the first existing record in the file whose record
number or key value is greater than the file position indicator
°
If REVERSED is specified, the first existing record in the file whose record
number or key value is less than the file position indicator
If the file position indicator was established by an earlier READ statement, and the
setting of the file position indicator reflects an alternate record key for which
duplicates are not allowed, then the record selected for retrieval is one of:
°
If NEXT is specified or implied, the first record in the file whose key value is
either equal to the file position indicator and whose logical position within the
set of duplicates is immediately after the record that was made available by
that previous READ statement, or whose key value is greater than the file
position indicator
°
If REVERSED is specified, the first record in the file whose key value is either
equal to the file position indicator and whose logical position within the set of
duplicates is immediately prior to the record that was made available by that
previous READ statement, or whose key value is less than the file position
indicator