COBOL Manual for TNS and TNS/R Programs
Data Fundamentals
HP COBOL Manual for TNS and TNS/R Programs—522555-006
4-26
Condition-Names
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 4-10 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:
88 RESTRICTED-USE VALUES ARE 1, 2.
SET RESTRICTED-USE TO TRUE
The SET statement sets USE-CODE to the value 1, the first value in the list.
Example 4-10. 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.