Class Condition
The class condition determines whether the operand is numeric, or alphabetic
or alphabetic-lower, or alphabetic-upper, 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.
General Format

Syntax Rules
- The class of an operand is determined as follows:
- An operand is numeric if it consists entirely of the characters 0,1, 2, 3,
... , 9, with or without an operational sign.
- An operand is alphabetic if it consists entirely of the upper-case letters
A, B, C, ... , Z, space,
or the lower-case letters a, b, c, ... , z, space,
or any combination of the upper-case
and lower-case
letters and spaces.
An operand is alphabetic-lower if it consists entirely of the lower-case
letters a, b, c, ... , z, and space.
An operand is alphabetic-upper if it consists entirely of the upper-case
letters A, B, C, ... , Z, and space.
An operand conforms to class-name-1 if it consists entirely of the characters
listed in the definition of class-name-1 in the Special-Names paragraph.
- Identifier-1 must reference a data item whose usage is explicitly or implicitly
DISPLAY, or in the case of the NUMERIC test, is one of: DISPLAY,
COMPUTATIONAL, COMPUTATIONAL-X,



COMPUTATIONAL-3

COMPUTATIONAL-5
or PACKED-DECIMAL.
If identifier-1 is a function-identifier, it must reference an alphanumeric
or national
function.
General Rules
- When the class condition does not include the word NOT and identifier-1 is
a zero-length group item, the result of the class test is always false.
When used, NOT and the next key word specify one class condition that defines
the class test to be executed for truth value; e.g. NOT NUMERIC is a
truth test for determining that an operand is nonnumeric. When the class condition
includes the word NOT and identifier-1 is a zero-length group item, the result
of the class test is always true.
The truth value of a class test involving a zero-length group item is reversed
by the ZEROLENGTHFALSE Compiler directive.
-
The NUMERIC test cannot be used with an item whose data
description describes the item as alphabetic or as a group item composed of
elementary items whose data description indicates the presence of operational
sign(s). If the data description of the item being tested does not indicate
the presence of an operational sign, the item being tested is determined to
be numeric only if the contents are numeric and an operational sign is not
present. If the data description of an elementary item being tested does indicate
the presence of an operational sign, the item being tested is determined to
be numeric only if the contents are numeric and a valid operational sign is
present. Valid operational signs for data items described with the SIGN IS
SEPARATE clause are the standard data format characters, "+" and "-"; valid
operational signs for data items not described with the SIGN IS SEPARATE clause
are described in the section Selection of Character Representation and Radix
in the chapter Concepts of the COBOL Language.

The NUMERIC test can be used with an item defined as a group item composed
of elementary items whose data description indicates the presence of operational
sign(s).
-
The ALPHABETIC test cannot be used with an item whose
data description describes the item as numeric. The item being tested is determined
to be alphabetic only if the contents consist of any combination of the upper-case
alphabetic characters "A" through "Z" and the space
and any combination of the lower-case alphabetic characters "a" through
"z"
and the space.


The class condition cannot be used for external floating-point (USAGE DISPLAY)
or internal floating-point (USAGE COMP-1 and USAGE COMP-2) items.
The ALPHABETIC-LOWER test cannot be used with an item whose data description
describes the item as numeric. The result of the test is true if the content
of the data item referenced by identifier-1 consists entirely of the lower-case
alphabetic characters "a" through "z" and space.
The ALPHABETIC-UPPER test cannot be used with an item whose data description
describes the item as numeric. The result of the test is true if the content
of the data item referenced by identifier-1 consists entirely of the upper-case
alphabetic characters "A" through "Z" and space.
The class-name-1 test must not be used with an item whose data description
describes the item as numeric.