COBOL Manual for TNS and TNS/R Programs

Data Fundamentals
HP COBOL Manual for TNS and TNS/R Programs522555-006
4-12
Tables
The setting of the file position indicator is irrelevant when the open mode is Output or
Extend or the access mode is Random, because no sequential record retrieval
operations are permitted in these cases.
Tables
You can define a table by including an OCCURS clause in a data description entry.
This clause specifies that the data item be repeated a stated number of times. The
item is a table element, and the item’s name and description apply to each repetition of
the element.
A table is a data structure composed of one or more occurrences of a specified data
item. The repeated data item is called a table element. The number of occurrences of a
table element can be fixed or variable. If the element is a table itself, or if it contains
other tables, the table to which the element belongs is multidimensional.
Because table elements do not have individual names, you must reference a table
element by the table name and its position in the table. Two methods for giving the
position number are subscripting and indexing. For information on subscripting, see
Subscripts. For information on indexing, see Using Indexes Instead of Subscripts.
Topics explain how to declare:
One-Dimensional Tables With Fixed Number of Elements
One-Dimensional Tables With Variable Number of Elements
Multidimensional Tables
One-Dimensional Tables With Fixed Number of Elements
You can define a table by including an OCCURS clause in a data description entry.
This clause specifies that the data item be repeated a stated number of times. The
item is a table element, and the item’s name and description apply to each repetition of
the element. For example, this entry defines a 1-dimensional table:
02 TOTAL OCCURS 20 TIMES ...
Each reference to TOTAL must have exactly one subscript (except in SEARCH
statements and some intrinsic functions, which do not allow subscripts).
Note. This topic applies to tables in the Data Division, not to SQL/MP or SQL/MX tables.