Compaq COBOL AAQ2G1FTK User Manual

Page 118

Advertising
background image

Handling Nonnumeric Data
3.6 Using the MOVE Statement

Table 3–2 Nonnumeric Elementary Moves

Receiving Item Category

Sending Item Category

Alphanumeric

Alphabetic

Alphanumeric Edited

ALPHABETIC

Valid

Valid

ALPHANUMERIC

Valid

Valid

ALPHANUMERIC EDITED

Valid

Valid

NUMERIC INTEGER
(DISPLAY ONLY)

Invalid

Valid

NUMERIC EDITED

Invalid

Valid

In all valid moves, the compiler treats the sending item as though it had been
described as PIC X(n). A JUSTIFIED clause in the sending item’s description has
no effect on the move. If the sending item’s PICTURE character-string contains
editing characters, the compiler uses them only to determine the item’s size.

In valid nonnumeric elementary moves, the receiving item controls the movement
of data. All of the following characteristics of the receiving item affect the move:

Its size

Editing characters in its description

The JUSTIFIED RIGHT clause in its description

The JUSTIFIED clause and editing characters are mutually exclusive.

When an item that contains no editing characters or JUSTIFIED clause in its
description is used as the receiving item of a nonnumeric elementary MOVE
statement, the compiler moves the characters starting at the leftmost position in
the item and proceeding, character by character, to the rightmost position. If the
sending item is shorter than the receiving item, the compiler fills the remaining
character positions with spaces. If the sending item is longer than the receiving
item, truncation occurs on the right.

Numeric items used in nonnumeric elementary moves must be integers in
DISPLAY format.

If the description of the numeric data item indicates the presence of an
operational sign (either as a character or an overpunched character), or if
there are P characters in its character-string, the compiler first moves the item to
a temporary location. It removes the sign and fills out any P character positions
with zero digits. It then uses the temporary value as the sending item as if it
had been described as PIC X(n). The temporary value can be shorter than the
original value if a separate sign was removed, or longer than the original value if
P character positions were filled with zeros.

If the sending item is an unsigned numeric class item with no P characters in its
character-string, the MOVE is accomplished directly from the sending item, and
a temporary item is not required.

If the numeric sending item is shorter than the receiving item, the compiler fills
the receiving item with spaces.

3–8 Handling Nonnumeric Data

Advertising