Control Data Corporation 3300 Reference Manual page 137

Computer systems usasi cobol/ master
Table of Contents

Advertisement

60229400
The starting point of a linear search may be established by using the SET
statement to preset values of the index names associated with the table.
SET need not be used with all SEARCH statements since the starting point of
a linear search depends on the current value of the index name associated
with the table or the index name specified
in
the VARYING option of the
SEARCH statement. Thus, one SET ... SEARCH combination can establish
a position within the table and subsequent SEARCH statements will begin
with the last setting of the table's index name. The SET statement does not
apply to a bisecting search since the initial setting of the index name is
ignored in that type of search.
Format 2:
The SEARCH ALL statement provides a bisecting nonserial type of search
operation. The initial setting of the index name for identifier-l is ignored
and the index name setting is varied as the bisecting search takes place.
The setting value will not exceed the location value of the last element in the
table, nor be less than the location value of the first element in the table.
If
condition-l is satisfied, the index points to the table entry that satisfied the
condition and the associated imperative statement is executed.
If
this im-
perative statement does not terminate with a GO TO, control passes to the
next sentence.
If
condition-l is not satisfied for any setting of the index within the range per-
mitted for the table, the imperative statement associated with the AT END
option is executed.
If
no AT END is specified, control passes to the next
sentence. When condition-l cannot be satisfied, the final setting of the index
is unpredictable.
Any or all data names in the KEY clause of identifier-l may appear as subjects
or objects of a test, or they may be conditional variables with which the tested
condition name is associated. All preceding data names in the KEY clause
hierarchy must also be tested within condition-I. No other tests may appear
in condition-I.
Examples:
1.
The following example shows a nons erial search of a one-dimensional
table:
DATA DIVISION.
01
TABLE-I.
03
ID-l PIC X(4) OCCURS 250 TIM:ES INDEXED BY INDX-l
ASCENDING KEY IS ill-I.
PROCEDURE DIVISION.
4-57

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the 3300 and is the answer not in the manual?

This manual is also suitable for:

3500

Table of Contents