COBOL Manual for TNS/E Programs (H06.08+, J06.03+)

CHARACTER-SET clause specifies a program character set other than USASCII or UK, the set
of characters that constitute the alphabetic class is extended as appropriate (see
OBJECT-COMPUTER Paragraph (page 102)).
Class-name and NOT Class-name
You cannot use the class-name and NOT class-name tests with a numeric data item. The result
of the test is TRUE if the content of the data item consists entirely of the characters listed in the
definition of the class-name in the SPECIAL-NAMES paragraph; otherwise the result is FALSE.
Class conditions are useful for field validation:
PART-NUMBER IS NUMERIC
REPLY-FIELD IS NOT ALPHABETIC
DIAGNOSTIC-MESSAGE IS NOT ALPHABETIC-UPPER
If the SPECIAL-NAMES paragraph includes the description
CLASS VOWEL IS "A" "E" "I" "O" "U" "a" "e" "i" "o" "u".
the procedure division can use this condition for validation:
SOME-FIELD IS VOWEL
Condition-Name Conditions (Conditional Variables)
In a condition-name condition, a conditional variable is tested to determine whether or not its value
is equal to one of the values or within one of the ranges of values associated with a condition-name.
Usage Considerations:
Condition-Name Conditions
The rules for comparing a conditional variable with the literal values corresponding to a
condition-name are the same as those specified for relation conditions.
The result of the test is TRUE if either of these relations is satisfied:
The value of the conditional variable equals one of the single values corresponding to
the condition-name.
The value of the conditional variable falls within one of the ranges of values, including
the end values, corresponding to the condition-name.
Example 68 Conditional Variables
WORKING-STORAGE SECTION.
01 ZIP-CODE.
03 ZIP-FIRST-3 PICTURE 999.
...
88 NEW-YORK VALUE IS 090 THRU 098,
100 THRU 149.
88 PENNSYLVANIA VALUE IS 150 THRU 196.
...
PROCEDURE DIVISION.
...
ELSE IF NEW-YORK MOVE "NY" TO STATE-FROM-ZIP
ELSE IF PENNSYLVANIA MOVE "PA" TO STATE-FROM-ZIP
...
IF STATE-INPUT NOT = STATE-FROM-ZIP
PERFORM QUERY-ZIP-OR-STATE-CORRECTION.
Switch-Status Conditions
A switch-status condition determines whether an external switch is on or off. The particular switch
and the ON or OFF value associated with the condition must be named in the SPECIAL-NAMES
paragraph of the Environment Division.
Conditional Expressions 271