Data Structures in COBOL - COBOL

Classes of Data

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

  1. Alphabetic
  2. Numeric
  3. Alphanumeric

For alphabetic and numeric, the classes and categories are synonymous.

The alphanumeric class includes the categories of alphanumeric edited, numeric edited and alphanumeric (without editing).

Every elementary item except for an index data item belongs both to one of the classes and to one of the categories.The class of a group item is treated at object time as alphanumeric regardless of the class of elementary items subordinate to that group item.

Table depicts the relationship of the class and categories of data items.

Data Item Relationships

Data Item Relationships

Standard Alignment Rules

The standard rules of positioning data within an elementary item depend on the category of the receiving item.

If the receiving data item is described as numeric:

  • The data is aligned by decimal point and is moved to the receiving character positions with zero fill or truncation on either end as required.
  • When an assumed decimal point is not explicitly specified, the data item is treated as if it had an assumed decimal point immediately following its rightmost character and is aligned as described above.

If the receiving data item is a numeric edited data item, the data moved to the edited data item is aligned by decimal point with zero-fill or truncation at either end as required within the receiving character positions of the data item, except where editing requirements cause replacement of the leading zeroes.

If the receiving data item is alphanumeric (other than a numeric edited data item), alphanumeric edited or alphabetic, the sending data is moved to the receiving character positions and aligned at the leftmost character position in the data item with space-fill or truncation to the right, as required.

If the JUSTIFIED clause is specified for the receiving item, these standard rules are modified as described in the JUSTIFIED clause.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

COBOL Topics