Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Indexing and subscripting compared

Availability of occurrence numbers for the user

Subscripting:

The occurrence number is immediately available.

Indexing:

The occurrence number is available only if preceded by a SET, SEARCH or PERFORM statement. It is calculated as follows:

value of index divided by length of table element plus 1.

References to table elements

Subscripting:

At object time, the address of the table element must be calculated anew each time from subscripts (except in the case of literal subscripts), i.e. subscripted data items cannot be referenced as quickly as data items outside the table.

Indexing:

When indexing is used, references to a table element are faster than subscripting using identifiers, since the displacement from the start of the table is already stored in the index.

Changing the index

Subscripting:

Changing a subscript in the form of a data-name (using MOVE, ADD etc.) is faster than changing an index-name using SET, since the SET statement requires that the occurrence number must first be converted to the displacement from the start of the table. This applies when the index is not being set up or down by a fixed integer value.

Indexing:

It is faster to change an index using PERFORM or SEARCH statements than to change a subscript.

Validity

Subscripting:

A subscript can also be used for other table elements.

Indexing:

An index may only be used with its associated table element (except in SET, PERFORM and SEARCH statements).