Pathway/iTS SCREEN COBOL Reference Manual (G06.24+, H06.03+, Pathway/iTS 1.0+)

SCREEN COBOL Source Program
Compaq NonStop™ Pathway/iTS SCREEN COBOL Reference Manual426750-001
2-26
Subscripting
The qualification rules are as follows:
Each qualifier must be at a higher level than the previous one and must stay within
the same structure of the name it qualifies.
The same name cannot appear at different levels in a structure; otherwise, the name
could qualify itself.
If a data name or a condition-name is assigned to more than one data item, the data
name or condition-name must be qualified each time it is referenced (except in the
REDEFINES clause where, by context, qualification is unnecessary).
A paragraph name cannot be duplicated within a section. Within its own section a
paragraph name does not require qualification. When a section name is used to
qualify a paragraph name, the word SECTION is not part of the name.
A data name used as a qualifier is not subscripted, even if the data name is described
with an OCCURS clause.
A name can be qualified even when the name is unique.
If more than one combination of qualifiers is available to make a name unique, any
combination can be used.
In the following example, all data names except prefix are unique. Qualification
must be used to reference either prefix item.
01 transaction-data ... 01 master-data ...
03 item-no ... 03 code-no ...
05 prefix ... 05 prefix ...
05 code ... 05 suffix ...
03 quantity ... 03 description ...
Using the same example, any of the following sentences could be used to move the
contents of one prefix to the other prefix:
MOVE prefix OF item-no TO prefix OF code-no.
MOVE prefix OF item-no TO prefix OF master-data.
MOVE prefix OF transaction-data TO prefix IN code-no.
MOVE prefix IN transaction-data TO prefix IN master-data.
Subscripting
Subscripts are used to reference elements in a table. They are needed because all table
elements have the same name.
The subscript can be an integer numeric literal or a data item that represents a numeric
integer. When the subscript is a data item, the data item name can be qualified but not
subscripted itself. The subscript can be signed and, if signed, it must be positive.
The lowest possible subscript value is 1. This value selects the first element of a table.
The other elements of the table are selected by subscripts whose values are 2, 3, 4, and
so forth. If a subscript value greater than the size of the table is used, the result is
undefined.