HP 3000 Manuals

Data Items - Classes and Categories [ HP COBOL II/XL Reference Manual ] MPE/iX 5.0 Documentation


HP COBOL II/XL Reference Manual

Data Items - Classes and Categories 

Data items in a COBOL program are specified and referenced very
precisely.  The various restrictions governing data items are outlined
below.

Classes of Data Items 

COBOL has three general classes of data items:

   *   Alphabetic, which can contain letters (A through Z) or spaces, in
       any combination.

   *   Numeric, which can contain digits (0 through 9) in any
       combination, optionally including an operational sign.  This is
       the only class of data item that can be used in arithmetic
       operations.

   *   Alphanumeric, which can contain any characters from the ASCII
       character set, in any combination.

       _________________________________________________________________ 

       NOTE  For complete compatibility with all ANSI COBOL compilers,
             use only members of the COBOL character set.

       _________________________________________________________________ 

Categories of Data Items 

The three classes of data items are subdivided into five categories:

   *   Alphabetic, which is synonymous with the alphabetic class.

   *   Numeric, which is synonymous with the numeric class.

   *   Alphanumeric, which can contain any characters from the ASCII
       character set in any combination, not edited by a PICTURE clause.

   *   Alphanumeric-edited, which can contain any characters from the
       ASCII character set in any combination, plus editing symbols
       supplied by a PICTURE clause.

   *   Numeric-edited, which can contain any digits (0 through 9), plus
       editing symbols supplied by a PICTURE clause.


NOTE More precise definitions of these categories appear under the description of the PICTURE clause in Chapter 7 .
These classes and categories are independent of the external or internal storage formats of the data items. The relation of classes to categories are summarized in Table 4-1 . For alphabetic and numeric data items, the classes and categories are synonymous. For alphanumeric data items, the relation of class to category depends on the level (group or elementary) of the data item within the record structure. Every elementary item (except an index data item) belongs to one of these classes and categories. During program execution, every group item is treated as an alphanumeric item regardless of the class of the elementary items subordinate to that group item. Table 4-1. Data Item Classes and Categories ---------------------------------------------------------------------------------------------- - Level of Item - Class - Category - ---------------------------------------------------------------------------------------------- - Elementary - Alphabetic - Alphabetic - ---------------------------------------------------------------------------------------------- - - Numeric - Numeric - ---------------------------------------------------------------------------------------------- - - Alphanumeric - Numeric Edited - - - - Alphanumeric Edited - - - - Alphanumeric - ---------------------------------------------------------------------------------------------- - Group - Alphanumeric - Alphabetic - - - - Numeric - - - - Numeric Edited - - - - Alphanumeric Edited - - - - Alphanumeric - ----------------------------------------------------------------------------------------------


MPE/iX 5.0 Documentation