Summary -

In this topic, we described about the Fixed-length tables with detailed example.

Specifies the number of OCCURS statically/directly. The table defines with the number of OCCURS specified with a static value while writing the program. Fixed-length tables are specified using the OCCURS clause.

Syntax -

FIXED-LENGTH Tables Syntax

integer-value

Specifies the exact number of occurrences. Integer-value must be greater than zero.

ASCENDING KEY AND DESCENDING KEY

Specifies the data is arranged in ascending or descending order based on the keyword specified according to the values contained in data-name. The order is determined by the rules for comparison of operands.

The ASCENDING KEY and DESCENDING KEY data items are used in OCCURS clauses for the SEARCH ALL statements and SORT statements. The total number of keys for a given table element must not exceed 12.

data-name

Data-name(s) is the name of the data item(s) on which basis the table is sorted (Either ascending or descending). Data-name must follow the table entry itself.

Data-name must not follow any other entry that contains an OCCURS clause. Data-name must not contain an OCCURS clause. Data-name must not have data items under it that contain OCCURS DEPENDING ON clauses.

INDEXED BY

Specifies the indexes that are used with a table. Indexes normally are allocated in static memory associated with the program. Indexes are in the last-used state if a program is re-entered.

index-name

Specifies an index to be created by the compiler for use by the program. These index-names are not data-names and are not identified elsewhere in the COBOL program.

Unreferenced index names need not be uniquely defined. Up to 12 index-names can be specified in one table entry.