Indexes can be used as subscripts while subscripts cannot be used as indexes.
-
True
-
False
Indexes in COBOL are special data types used with the OCCURS clause for table processing. They can be converted to subscripts using the SET statement, making indexes usable as subscripts. However, subscripts are ordinary numeric data items and cannot be used directly as indexes because they lack the internal structure required for index operations.
In COBOL, wherever the language allows a subscript to reference a table element, an index-name may be used instead — indexes are a superset capability. The reverse isn't true: a plain subscript (an ordinary numeric data item) cannot be used in place of an index-name, because index-names require SET/PERFORM ... VARYING semantics tied to the table's INDEXED BY clause that ordinary subscripts don't provide.