The class condition determines whether the content of a data item is alphabetic, alphabetic-lower, alphabetic-upper, numeric, DBCS, KANJI, or contains only the characters in the set of characters specified by the CLASS clause as defined in the SPECIAL-NAMES paragraph of the environment division.
Format >>-identifier-1--+----+--+-----+--+-NUMERIC----------+--------->< '-IS-' '-NOT-' +-ALPHABETIC-------+ +-ALPHABETIC-LOWER-+ +-ALPHABETIC-UPPER-+ +-class-name-------+ +-DBCS-------------+ '-KANJI------------'
Must not be of class alphabetic when NUMERIC is specified.
Must not be of class numeric when ALPHABETIC, ALPHABETIC-UPPER, or ALPHABETIC-LOWER is specified.
Table 1 lists the forms of class condition that are valid for each type of identifier.
If identifier-1 is a function-identifier, it must reference an alphanumeric or national function.
An alphanumeric group item can be used in a class condition where an elementary alphanumeric item can be used, except that the NUMERIC class condition cannot be used if the group contains one or more signed elementary items.
When identifier-1 is described with usage NATIONAL, the class-condition tests for the national character representation of the characters associated with the specified character class. For example, specifying a class condition of the form IF national-item IS ALPHABETIC is a test for the lowercase and uppercase letters Latin capital letter A through Latin capital letter Z and the space, as represented in national characters. Specifying IF national-item is NUMERIC is a test for the characters 0 through 9.
If its PICTURE does not contain an operational sign, the identifier being tested is determined to be numeric only if the contents are numeric and an operational sign is not present.
If its PICTURE does contain an operational sign, the identifier being tested is determined to be numeric only if the item is an elementary item, the contents are numeric, and a valid operational sign is present.
Usage note: Valid operational signs are determined from the setting of the NUMCLS installation option and the NUMPROC compiler option. For more information, see the Enterprise COBOL Programming Guide .
A range check is performed on the item for valid character representation. The valid range is X'41' through X'FE' for both bytes of each DBCS character and X'4040' for the DBCS blank.
A range check is performed on the item for valid character representation. The valid range is from X'41' through X'7E' for the first byte, from X'41' through X'FE' for the second byte, and X'4040' for the DBCS blank.
| Type of data item referenced by identifier-1 | Valid forms of the class condition | |
|---|---|---|
| Alphabetic | ALPHABETIC |
NOT ALPHABETIC |
| Alphanumeric, alphanumeric-edited, or numeric-edited | ALPHABETIC |
NOT ALPHABETIC |
External-decimal |
NUMERIC | NOT NUMERIC |
| DBCS | DBCS |
NOT DBCS |
| National | NUMERIC |
NOT NUMERIC |
| Numeric | NUMERIC |
NOT NUMERIC |