2 handling numeric data, Handling numeric data, 1 how the compiler stores numeric data – Compaq COBOL AAQ2G1FTK User Manual

Page 95: 2 specifying alignment

Advertising
background image

2

Handling Numeric Data

Numeric data in Compaq COBOL is evaluated with respect to the algebraic
value of the operands.

This chapter describes the following topics concerning numeric data handling:

How the compiler stores numeric data (Section 2.1)

Specifying alignment (Section 2.2)

Sign conventions (Section 2.3)

Invalid values in numeric items (Section 2.4)

Evaluating numeric items (Section 2.5)

Using the MOVE statement (Section 2.6)

Using the arithmetic statements (Section 2.7)

2.1 How the Compiler Stores Numeric Data

Understanding how data is stored will help you in the following situations:

When you define data items to participate in group moves or to be the subject
of a REDEFINES clause

When you move a complex record consisting of several levels of subordination,
to be sure that the receiving item is large enough to prevent data truncation

When you need to use data storage concepts to minimize storage space,
particularly when the data file is large

The storage considerations applicable to tables are described in Chapter 4.

For each numeric data item, Compaq COBOL stores the numeric value, and a
sign (if an S appears in the PICTURE clause).

The USAGE clause of a numeric data item specifies the data’s internal format in
storage. When you do not specify a USAGE clause, the default usage is DISPLAY.
For further information about internal representations, see the USAGE clause
tables in the Compaq COBOL Reference Manual.

2.2 Specifying Alignment

In Compaq COBOL, all records, and elementary items with level 01 or 77, begin
at an address that is a multiple of 8 bytes (a quadword boundary). By default,
the Compaq COBOL compiler will locate a subordinate data item at the next
unassigned byte location. However, the SYNCHRONIZED clause, the

-align

flag (on Tru64 UNIX), the /ALIGNMENT qualifier (on OpenVMS Alpha), and
alignment directives can be used to modify this behavior, causing some numeric
data items to be aligned on a 2-, 4-, or 8-byte boundary. You can thus tune data
alignment for optimum performance, compatibility with Compaq COBOL for

Handling Numeric Data 2–1

Advertising