COBOL Manual for TNS and TNS/R Programs

Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs522555-006
9-247
START
Suppose a requester asks for a set of records from a member of a context-free
server class: all the records that have a certain alternate key value, or partial value.
If the message buffer cannot hold all such records, the server can return the first
group of records plus the value of the unique key with the reply. This value is that
of the prime record key, the relative key, or the entire alternate key declared as
having no duplicates. Then the requester can ask for another group, supplying the
value of both the partial alternate key and the unique key, and the server can
resume with the last record it had sent or (by using the AFTER phrase) the record
beyond that. The server can remain context-free, because the information
necessary to do the positioning and to establish the key of reference and the
comparison length (for partial keys) accompanies the request.
°
GENERIC Positioning Mode and the POSITION Phrase
The choice of APPROXIMATE or GENERIC positioning mode, coupled with
the KEY clause, govern where the next READ statement starts reading and
what constitutes the end of the file (or the beginning of the file, if the file is
being read in reverse). A common use of GENERIC involves reading all
records that have a common value in the leftmost subordinate of a given
alternate key; for example, all records that have a 10-character alternate key,
where the first five characters of that key have the value “A5R32.” Under the
GENERIC mode, the program reads records until it encounters one that has
something different in the first five characters for that alternate key, then the
program receives an end-of-file condition instead of a new record value.
Only if the file contains multiple records that have the same value for the
complete alternate key (not just the leftmost subordinate) can the POSITION
phrase be used as outlined in the general discussion earlier to process groups
of records.
°
BEFORE and AFTER Phrases
If neither the BEFORE phrase nor the AFTER phrase is included, the
execution of the START statement sets the file position indicator to point to the
record uniquely identified by the two key values.
If the BEFORE phrase is included, the execution of the START statement sets
the file position indicator to point to the record preceding the one that the two
key values uniquely identify.
If the AFTER phrase is included, the execution of the START statement sets
the file position indicator to point to the record following the one that the two
key values uniquely identify.
INSERTIONORDER Attribute Incompatible with POSITION Phrase
The POSITION phrase can be used only if the file on which the START statement
is operating has the NO INSERTIONORDER attribute; that is, records with
duplicate values of an alternate key are delivered in principal key order.