HP 3000 Manuals

Concepts of Classes of Data [ COBOL/HP-UX Language Reference for the Series 700 and 800 ] MPE/iX 5.0 Documentation


COBOL/HP-UX Language Reference for the Series 700 and 800

Concepts of Classes of Data 

The seven categories of data items (see The PICTURE Clause in the chapter
The Nucleus) are grouped into three classes; alphabetic, numeric, and
alphanumeric.  For alphabetic and numeric, the classes and categories are
equivalent.  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 to one of the
classes and further 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.
________________________________________________________________________
|(ANS85)                                                               |
|Every data item which is a function is an elementary item, and        |
|belongs to one of the categories alphanumeric or numeric, and         |
|to the corresponding class; the category of each function is          |
|determined by the definition of the function.  This definition is     |
|made in these specifications.  (See Chapter 4  Intrinsic           |
|Functions.)                                                           |
________________________________________________________________________

            

The following table depicts the relationship of the class and categories
of data items.

          Table 2-3.  Data Levels, Classes and Categories 

[]
Algebraic Signs Algebraic signs fall into two categories; operational signs, which are associated with signed numeric data items and signed numeric literals to indicate their algebraic properties; and editing signs, which appear on edited reports to identify the sign of the item. The SIGN clause permits the programmer to state explicitly the location of the operational sign. The clause is optional; if it is not used, operational signs will be represented as defined by setting bit 6 of the trailing digit for ASCII numbers (see above). Editing signs are inserted into a data item through the use of the sign control symbols of the PICTURE clause. Standard Alignment Rules The standard rules for positioning data within an elementary item depend on the category of the receiving item. These rules are: 1. If the receiving data item is described as numeric: a. 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. b. 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 in paragraph a. above. 2. If the receiving data item is a numeric edited data item, the data moved to the edited 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 zeros. 3. 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. ________________________________________________________________________ |(MF) (OSVS) (VSC2) | | | | | | | |4. If the receiving data item is external floating-point the data is | | aligned on the leftmost digit position: the exponent is adjusted | | accordingly. | | | ________________________________________________________________________ If the JUSTIFIED clause is specified for the receiving item, these standard rules are modified as described in "The JUSTIFIED Clause" in the chapter The Nucleus. Item Alignment for Increased Object-code Efficiency Some computer memories are organized in such a way that there are natural addressing boundaries in the computer memory (for example, word boundaries, half-word boundaries, byte boundaries). The way in which data is stored is determined by the object program, and need not respect these natural boundaries. However, certain uses of data (for example, in arithmetic operations or in subscripting) can be facilitated if the data is stored so as to be aligned on these boundaries. Specifically, additional machine operations in the object program can be repeated for the accessing and storage of data if portions of two or more data items appear between adjacent natural boundaries, or if certain natural boundaries divide a single data item. Data items which are aligned on these natural boundaries in such a way as to avoid additional machine operations are defined to be synchronized. A synchronized item is assumed to be introduced and carried in that form; conversion to synchronized form occurs only during the execution of a statement (other than READ or WRITE) which stores data in the item. Synchronization can be accomplished in two ways: 1. By use of the SYNCHRONIZED clause. 2. By organizing the data suitably on the appropriate natural boundaries without the use of the SYNCHRONIZED clause. By use of the SYNCHRONIZED clause, the use of special types of alignment within a group can affect the results of statements in which the group is used as an operand. The effect of the implicit FILLER and the semantics of any statement referencing these groups is described later in this chapter. Selection of Character Representation and Radix The value of a numeric item (defined as numeric by its PICTURE, see The PICTURE Clause - Numeric Data Rules in the chapter The Nucleus) can be represented in the computer's storage in either binary or decimal form depending on the USAGE clause of the declaration (see "The USAGE Clause" in the chapter The Nucleus). These numeric formats are: * DISPLAY * COMPUTATIONAL, COMP, BINARY,(ANS85) COMPUTATIONAL-4 or COMP-4(OSVS)(VSC2) * COMPUTATIONAL-3, COMP-3 or (OSVS)(VSC2)(MF)(XOPEN) PACKED-DECIMAL (ANS85) * COMPUTATIONAL-5, COMP-5, COMPUTATIONAL-X or COMP-X (MF) * COMPUTATIONAL-1, COMPUTATIONAL-2 (OSVS)(VSC2)(MF) * POINTER (VSC2)(MF) * PROCEDURE POINTER (MF) ________________________________________________________________________ |(ANS85) | |An alphanumeric function is always represented in the standard data | |format. The size of an alphanumeric function in standard data format | |characters is determined by the definition of the function. The | |implementor specifies the representation of integer and numeric | |functions, and this representation need not be the standard data | |format. Integer and numeric functions can be used only in arithmetic | |expressions. An integer or numeric function represents the | |value resulting from the evaluation of the function without | |the restriction on composite of operands and/or receiving data | |items. | ________________________________________________________________________ When a computer provides more than one means of representing data, the standard data format must be used for data items other than integer and numeric functions, (ANS85) if not otherwise specified by the data description. DISPLAY Format. The numeric digit characters that represent the number value are held in radix 10, one digit character per byte of computer storage, in ASCII representation. This is the standard data format of the COBOL language. If the data item is signed and the sign is not specified as SEPARATE (see "The SIGN Clause" in the chapter The Nucleus) the numeric sign is incorporated into either the leading or trailing digit, according to the LEADING or TRAILING phrase in the SIGN clause. Signed data is incorporated into the requisite digit as shown in Table 2-4 below (effectively, bit 6 (value "40" ) of the character is set from 0 to 1 if the number has a negative value). If the data item is signed and the sign is specified as SEPARATE, then the sign is held as a separate single character, additional to the digits, either ASCII character "+" or "-" as necessary. This sign character appears as the leading or trailing byte of the stored numeric data item according to the LEADING or TRAILING phrase of the sign clause. [REV BEG] Table 2-4. DISPLAY Non-SEPARATE Sign-Digit Characters ---------------------------------------------------------------------------------------------------------- | Leading or | Sign Digit Character for: | | trailing | | | value | | | digit before | | | sign | | | incorp- | | | oration | | ---------------------------------------------------------------------------------------------------------- - - Positively-signed values - Negatively-signed values - ---------------------------------------------------------------------------------------------------------- | | Charset (ASCII) | Charset | Charset (ASCII) | Charset | | | | (EBCDIC) | | (EBCDIC) | ---------------------------------------------------------------------------------------------------------- | | Sign | Sign | Sign | Sign | Sign | Sign | | | (ASCII) | (EBCDIC) | (EBCDIC) | (ASCII) | (EBCDIC) | (EBCDIC) | | 0 | 0(30) | {(7B) | {(C0) | p(70) | }(7D) | }(D0) | | 1 | 1(31) | A(41) | A(C1) | q(71) | J(4A) | J(D1) | | 2 | 2(32) | B(42) | B(C2) | r(72) | K(4B) | K(D2) | | 3 | 3(33) | C(43) | C(C3) | s(73) | L(4C) | L(D3) | | 4 | 4(34) | D(44) | D(C4) | t(74) | M(4D) | M(D4) | | 5 | 5(35) | E(45) | E(C5) | u(75) | N(4E) | N(D5) | | 6 | 6(36) | F(46) | F(C6) | v(76) | O(4F) | O(D6) | | 7 | 7(37) | G(47) | G(C7) | w(77) | P(50) | P(D7) | | 8 | 8(38) | H(48) | H(C8) | x(78) | Q(51) | Q(D8) | | 9 | 9(39) | I(49) | I(C9) | y(79) | R(52) | R(D9) | ---------------------------------------------------------------------------------------------------------- [REV END] Storage character position requirements for DISPLAY data items are thus equal to the number of "9"s in the PICTURE clause plus one if the sign is specified as SEPARATE. The SYNCHRONIZED clause has no effect on DISPLAY form at data declarations.


MPE/iX 5.0 Documentation