In this topic, we described about the Class Condition with detailed example.
The class condition determines whether the content of a data item is alphabetic, alphabetic-lower, alphabetic-upper, numeric or contains only the characters specified by the CLASS clause as defined in the SPECIAL-NAMES paragraph of the environment division.
Specify a data item defined with one of the following usages -
- DISPLAY, COMPUTATIONAL-3 or PACKED-DECIMAL when NUMERIC is specified
- DISPLAY when ALPHABETIC, ALPHABETIC-UPPER or ALPHABETIC-LOWER is specified
- DISPLAY when class-name is specified
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.
NOT and the next keyword define the class test for truth value. For example, NOT NUMERIC is a truth test for determining the result of a NUMERIC class test is false (in other words, the item contains data that is nonnumeric).
identifier-1 consists entirely of the characters 0 through 9 with or without sign. If its PICTURE does not contain sign, the identifier being tested and determined to be numeric only if the contents are numeric and sign is not present.
If its PICTURE does contain sign, the identifier being tested and determined to be numeric only if the item is an elementary item, the contents are numeric, and a valid sign is present.
identifier-1 consists any combination of the lowercase or uppercase Latin alphabetic characters A through Z and the space.
identifier-1 consists any combination of the lowercase Latin alphabetic characters a through z and the space.
identifier-1 consists any combination of the uppercase Latin alphabetic characters A through Z and the space.
identifier-1 consists of the characters listed in the definition of class-name in the SPECIAL-NAMES paragraph.
Valid forms of the class condition for different types of data items -
|Type of data item referenced by identifier-1||Valid forms of the class condition|