Compaq COBOL AAQ2G1FTK User Manual

Page 119

Advertising
background image

Handling Nonnumeric Data

3.6 Using the MOVE Statement

3.6.2.1 Edited Moves

This section explains the following insertion editing characters:

B

Blank insertion position

0

Zero insertion position

/

Slash insertion position

When an item with an insertion editing character in its PICTURE character-
string is the receiving item of a nonnumeric elementary MOVE statement, each
receiving character position corresponding to an editing character receives the
insertion byte value. Table 3–3 illustrates the use of such symbols with the
following statement, where FIELD1 is described as PIC X(7):

MOVE FIELD1 TO FIELD2

Table 3–3 Data Movement with Editing Symbols

FIELD1

FIELD2

Character-String

Contents After MOVE

070476

XX/99/XX

07/04/76

04JUL76

99BAAAB99

04sJULs76

2351212

XXXBXXXX/XX/

235s1212/ss/

123456

0XB0XB0XB0X

01s02s03s04

Legend: s = space

Data movement always begins at the left end of the sending item and moves
only to the byte positions described as A, 9, or X in the receiving item PICTURE
character-string. When the sending item is exhausted, the compiler supplies
space characters to fill any remaining character positions (not insertion positions)
in the receiving item. If the receiving item is exhausted before the last character
is moved from the sending item, the compiler ignores the remaining sending item
characters.

Any necessary conversion of data from one form of internal representation to
another takes place during valid elementary moves, along with any editing
specified for, or de-editing implied by, the receiving data item.

3.6.2.2 Justified Moves

A JUSTIFIED RIGHT clause in the receiving item’s data description causes the
compiler to reverse its usual data movement conventions. It starts with the
rightmost characters of both items and proceeds from right to left. If the sending
item is shorter than the receiving item, the compiler fills the remaining leftmost
character positions with spaces. If the sending item is longer than the receiving
item, truncation occurs on the left. Table 3–4 illustrates various PICTURE
character-string situations for the following statement:

MOVE FIELD1 TO FIELD2

Handling Nonnumeric Data 3–9

Advertising