COBOL Manual for TNS and TNS/R Programs

Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs522555-006
9-243
START
2. When the file does not contain a qualifying record, the invalid-key condition
exists and the start operation terminates with the I-O status code “23.” When
the search operation succeeds, the file position indicator is set to the value of
the key of reference for the record found.
The execution of the START statement does not alter the contents of the
record area associated with file-name or the content of the depending item
specified in the DEPENDING phrase of the RECORD clause that describes
file-name.
File-Status Data Item
If file-name has an associated file-status data item, execution of the START
statement always assigns an appropriate I-O status code to it. The value “00”
reports an unconditionally successful start operation. The value “97” reports a
successful start operation that validated a position by reading a locked record.
Note. Use care in specifying the starting record. When you are starting a file with
APPROXIMATE positioning (which is the default), the value you use for wait-time
must take into account that a START can take somewhat longer than expected. This
can occur when the START leads to a nonexistent record, because the file system
searches through the file looking for the next defined record before reporting the
absence of the record sought.
Suppose that your file contains alternate keys that can have duplicates, and one such
alternate key is DEPT-NUM. If you want to start at the department whose number
follows 5440, it is more efficient to use a START of the form
MOVE "5441" TO DEPT-NUM.
START MYFILE KEY IS NOT LESS THAN DEPT-NUM.
than it is to use
MOVE "5440" TO DEPT-NUM.
START MYFILE KEY IS GREATER THAN DEPT-NUM.
because the latter form causes the file system to sequentially read each record having
the key value “5440until it finds a record whose key exceeds 5440. The time saved
depends upon the number of duplicates in the file.
See the Guardian Programmer’s Guide for more information on the action of READ
(which is called by the START logic).