Classes and categories of data
Most data and all literals used in a COBOL program are divided into classes and categories. Data classes are groupings of data categories. Data categories are determined by the attributes of data description entries or function definitions.
For more information about data categories, see Category descriptions.
The following elementary data items do not have a class and category:
- Index data items
- Items described with USAGE POINTER, USAGE FUNCTION-POINTER, USAGE PROCEDURE-POINTER, or USAGE OBJECT REFERENCE
A function references an elementary data item and belongs to the data class and category associated with the type of the function, as shown in Table 2.
Literals have a class and category as shown in Table 3. Figurative constants (except NULL) have a class and category that depends on the literal or value represented by the figurative constant in the context of its use. For details, see Figurative constants.
All group items have a class and category, even if the subordinate elementary items belong to another class and category. For the classification of group items, see Classes and categories of group items.
Class of elementary data items2 | Category | Usage |
---|---|---|
Alphabetic | Alphabetic | DISPLAY |
Alphanumeric | Alphanumeric | DISPLAY |
Alphanumeric-edited | DISPLAY | |
Numeric-edited | DISPLAY | |
Timestamp1 | DISPLAY | |
DBCS1 | DBCS1 | DISPLAY-1 |
National1 | National1 | NATIONAL |
National-edited1 | NATIONAL | |
Numeric-edited1 | NATIONAL | |
Numeric | Numeric | DISPLAY (type zoned decimal) |
NATIONAL (type national decimal) | ||
PACKED-DECIMAL (type internal decimal) | ||
COMP-3 (type internal decimal) | ||
BINARY | ||
COMP | ||
COMP-4 | ||
COMP-5 | ||
Internal floating-point1 | COMP-1 | |
COMP-2 | ||
External floating-point1 | DISPLAY | |
NATIONAL |
Function type | Class and category |
---|---|
Alphanumeric | Alphanumeric |
National | National |
Integer | Numeric |
Numeric | Numeric |
Literal | Class and category |
---|---|
Alphanumeric
(including hexadecimal formats) |
Alphanumeric |
DBCS | DBCS |
National
(including hexadecimal formats) |
National |
Numeric
(fixed-point and floating-point) |
Numeric |