COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
qualified-name
is defined in Qualified Names (page 67).
subscript
is defined in Subscript Syntax.
leftmost-character-position
is an arithmetic expression. Its value must be a positive nonzero integer less than or equal to
the number of characters in data-name; it represents the leftmost character of the portion of
data-name you are selecting.
length
is an arithmetic expression. Its value must be a positive, nonzero integer; it represents the size
of the portion of data-name you are selecting. The value of the expression
(leftmost-character-position + length ) - 1
must be less than or equal to the number of characters in data-name.
If length is absent, the defined item begins with leftmost-character-position and
ends with the last character of data-name ; thus the length of the defined item is
(data-name-length -leftmost-character-position ) + 1
where data-name-length is the length of data-name.
Example 20 Identifiers
UNIQUE-IDENTIFIER
ITEM-1 OF GROUP-A
ELEMENT OF NAME-TABLE OF MASTER-RECORD (LAST-ACCESSES)
PROD-NAME OF ITEM-X (ITEM-DEX) (1:15)
Condition-Names
Often an item in a record is tested frequently by a program. Assigning a condition-name to the
item is a convenient way to refer to the item and show the significance of the item’s value.
Every condition-name referred to in a COBOL program must be unique or capable of being made
unique through qualifiers, subscripts, or a combination of qualifiers and subscripts. If you use
qualifiers to make a condition-name unique, you can use the conditional variable as the first
qualifier. You can also use the structure of names for the conditional variable as a qualifier. If
references to a conditional variable require subscripting, then any of its condition-names also
require subscripting.
Example 21 defines a condition-name for the conditional variable USE-CODE.
Example 21 Condition-Name
01 INVENTORY.
02 PART-NUMBER OCCURS 100 TIMES.
03 PREFIX PICTURE 99.
03 USE-CODE PICTURE 9.
88 RESTRICTED-USE VALUE 1.
03 SUPPLIER-SUFFIX PICTURE 99.
This IF statement uses the condition-name RESTRICTED-USE to test the value of USE-CODE:
IF RESTRICTED-USE IN PART-NUMBER (30)
PERFORM REPORT-VIOLATION
ELSE ...
Using condition-names also makes it easier to modify the program. Suppose the table definition
in Example 21 changes so that both 1 and 2 mean RESTRICTED-USE. Without the use of a
condition-name, the program must examine and possibly change each instance of the testing of
the value of USE-CODE. With the condition-name, only the data description entry needs changing:
94 Data Fundamentals










