ILE COBOL Language Reference
An elementary move is one in which the receiving item is an elementary
item, and the sending item is an elementary item or a literal. Any
necessary conversion of data from one form of internal representation to
another takes place during the move, along with any specified editing in, or
de-editing implied by, the receiving item.
De-editing
is the logical removal of all editing characters from a numeric-edited data
item in order to determine that item's unedited numeric
value.
+-------------------------------IBM Extension--------------------------------+
De-editing also occurs for items of class date-time. In this case,
all separators, and any conversion specifiers that are not numeric, are
removed from the date-time item, resulting in a numeric value.
+----------------------------End of IBM Extension----------------------------+
Each elementary item belongs to one of the following categories:
The following rules outline the execution of valid elementary moves.
When the receiving item is:
- Alignment and any necessary space filling take place, as
described under Alignment Rules.
- If the size of the sending item is greater than the size of the receiving
item, excess characters on the right are truncated after the receiving item is
filled.
- If the sending item has an operational sign, the absolute value is
used. If the operational sign occupies a separate character, that
character is not moved, and the size of the sending item is considered to be
one less character than the actual size.
+-------------------------------IBM Extension--------------------------------+
- If the sending item is Boolean, the data is moved as if the sending item
were described as an alphanumeric item of length 1.
- If the sending item is national, it will be converted before it is
passed to the receiving field. The conversion is performed based on the
data translation rule described in National.
- If the sending item is date-time, the date-time item is treated like an
alphanumeric item, and moved to the receiver following the rules for an
alphanumeric to alphanumeric move. If the sending date-time item has a
USAGE of PACKED-DECIMAL, it is first converted to a USAGE of DISPLAY.
- If the receiving item is alphanumeric or numeric-edited, and the sending
item is a scaled integer (that is, has a P as the rightmost character in its
PICTURE character-string), the scaling positions are treated as trailing zeros
when the MOVE statement is executed.
- If the receiving item is numeric and the sending item is alphanumeric
literal or ALL literal, then all characters of the literal must be numeric
characters.
+----------------------------End of IBM Extension----------------------------+
- If the receiver is numeric, alignment by decimal point and any necessary
zero filling take place, as described under Alignment Rules.
- If the receiving item is signed, the sign of the sending item is placed in
the receiving item, with any necessary sign conversion. If the sending
item is unsigned, a positive operational sign is generated for the receiving
item.
- If the receiving item is unsigned, the absolute value of the sending item
is moved, and no operational sign is generated for the receiving item.
- When the sending item is alphanumeric, the data is moved as if the sending
item were described as an unsigned integer.
+-------------------------------IBM Extension--------------------------------+
- When the sending item is floating-point, the data is first converted to
either a binary or internal decimal representation and is then
moved.
+----------------------------End of IBM Extension----------------------------+
- De-editing
allows the moving of a numeric-edited data item into a numeric or
numeric-edited receiver. The compiler accomplishes this by first
establishing the unedited value of the numeric-edited item (this value can be
signed), then moving the unedited numeric value to the receiving numeric or
numeric-edited data item.
+-------------------------------IBM Extension--------------------------------+
- When the sending item is date-time, the date-time item is first
de-editied. The unedited value of the date-time item is then moved to
the receiving numeric or numeric-edited data item.
- If the receiver is numeric-edited, it may be specified with or without a
LOCALE phrase. If the LOCALE phrase of the PICTURE clause has
not been specified in its data description entry, 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 LOCALE phrase has been specified, alignment
and zero-fill truncation take place as described in LOCALE Phrase.
- If the receiving item is alphanumeric or numeric-edited, and the sending
item is a scaled integer (that is, has a P as the rightmost character in its
PICTURE character-string), the scaling positions are treated as trailing zeros
when the MOVE statement is executed.
- If the receiving item is numeric and the sending item is alphanumeric
literal or ALL literal, then all characters of the literal must be numeric
characters.
+----------------------------End of IBM Extension----------------------------+
+-------------------------------IBM Extension--------------------------------+
- The sending item is converted first to an internal floating-point item,
and then moved.
- When data is moved to or from an external floating-point item, the data is
converted to or from its equivalent internal floating-point value.
- It is possible that when an external floating-point literal is moved to an
external floating-point data item, the external floating-point data item can
receive an inaccurate value. This is because the floating-point data
type is an approximation. When an external floating-point literal is
moved, it is first converted to a true floating-point value (IEEE), which can
also affect its accuracy.
For example, consider the following MOVE:
77 external-float-1 PIC +9(3).9(13)E+9(3).
MOVE +123455779012.3453E+297 to external-float-1.
DISPLAY "EXTERNAL-FLOAT-1=" external-float-1.
The displayed result of the MOVE is:
EXTERNAL-FLOAT-1=+123.4557790123452E+306
+----------------------------End of IBM Extension----------------------------+
+-------------------------------IBM Extension--------------------------------+
- If the sending item is date-time, then the format of the sending date-time
item is first converted to the receiver's format, and then moved.
If the sending item is a timestamp, and the receiving item is a date or time
item, then only the date or time portion of the timestamp item is moved to the
receiving item. If the sending item is a date or time item and the
receiving item is a timestamp, only the date or time portion of the timestamp
is replaced.
- If the sending item is numeric, each of the receiving items numeric
conversion specifiers are replaced with the digits from the sending item,
beginning at the rightmost conversion specifier, and at the rightmost digit of
that conversion specifier. All alphanumeric conversion specifiers take
on default values.
- If the sending item is numeric-edited, the numeric-edited item is
de-edited. The resulting numeric value is then moved to the date-time
item.
- If the sending item is alphanumeric or alphanumeric-edited, the receiving
date-time item is treated as an alphanumeric item, and the move takes place
according to the rules for an alphanumeric to alphanumeric move.
+----------------------------End of IBM Extension----------------------------+
+-------------------------------IBM Extension--------------------------------+
- For a Boolean receiving item, only the first byte of the sending item is
moved.
- If the sending item is alphanumeric, the first character of the sending
item is moved. The characters "0" and "1" are equivalent to the Boolean
values B"0" and B"1", respectively.
- If the sending item is ZERO, it is treated as the Boolean literal
B"0".
+----------------------------End of IBM Extension----------------------------+
+-------------------------------IBM Extension--------------------------------+
- If the sending item is national, it will be converted before it is
passed to the receiving field. The conversion is performed based on the
data translation rule described in National.
- Otherwise, no conversion takes place
- If the sending and receiving items are not of the same size, the data item
is truncated or padded with DBCS spaces (on the right) as appropriate.
+----------------------------End of IBM Extension----------------------------+
+-------------------------------IBM Extension--------------------------------+
A national data item may receive data from an alphabetic, alphanumeric,
DBCS, or national data item, and also from a nonnumeric, DBCS, or national
hexadecimal literal, or the fugurative constant SPACE/SPACES.
Data moved to such an item is aligned at the leftmost character position
and, where necessary, truncated or padded to the right with the padding
character specified in the Padding Character command option or NTLPADCHAR
option of the PROCESS statement. For information about the PROCESS
statement, see ILE COBOL for AS/400 Programmer's
Guide.
If the data that is being transfered is not national data, it will be
converted from its representation in the sending field according to the data
translation rule before it is placed in the receving field.
The data translation is performed by mapping each character defined in a
source Coded Character Set Identifier (CCSID) to a target CCSID. CCSID
13488 is used to define national data CCSID.
The following rules determine the CCSID associated with other data
items:
- A nonnumeric literal uses the CCSID specified for the program source
file.
- A DBCS literal uses the DBCS CCSID corresponding to the CCSID specified
for the program source file.
- A single-byte data item, such as alphabetic or alphanumeric, uses the
CCSID specified by the second item in the CCSID options of the PROCESS
statement.
- A DBCS data item uses the CCSID specified by the third item in the CCSID
options of the PROCESS statement.
+----------------------------End of IBM Extension----------------------------+
Table 30 shows valid
and invalid elementary moves for each category. In the table:
- YES = Move is valid.
- NO = Move is invalid
Table 30. Valid Elementary Moves
Sending Item
Category
| Receiving Item Category
|
|
| Alphabetic
|
Alphanumeric,
Alphanumeric-edited
|
Numeric,
Numeric-edited
| BOOLEAN (6)
| DBCS (8)
|
External
Floating-Point (6)
|
Internal
Floating-Point (6)
| Date (6)
| Time (6)
| Timestamp (6)
| National (6)
|
|---|
| Alphabetic and SPACE
| YES
| YES
| NO
| NO
| NO
| NO
| NO
| NO
| NO
| NO
| YES
|
| Alphanumeric (1)
| YES
| YES
| YES
| YES (5)
| NO
| YES (9)
| YES (9)
| YES
| YES
| YES
| YES
|
| Alphanumeric-edited
| YES
| YES
| NO
| NO
| NO
| NO
| NO
| YES
| YES
| YES
| NO
|
| Numeric Integer (2)
| NO
| YES
| YES
| NO
| NO
| YES
| YES
| YES
| YES
| YES
| NO
|
| Numeric Noninteger (3)
| NO
| NO
| YES
| NO
| NO
| YES
| YES
| NO
| NO
| NO
| NO
|
| Numeric-edited
| NO
| YES
| YES
| NO
| NO
| YES
| YES
| YES
| YES
| YES
| NO
|
| LOW/HIGH-VALUE, QUOTES
| NO
| YES
| NO
| NO
| NO
| NO
| NO
| NO
| NO
| NO
| NO
|
| ZERO
| NO
| YES
| YES
| YES
| NO
| YES
| YES
| NO
| NO
| NO
| NO
|
| BOOLEAN (4) (6)
| NO
| YES
| NO
| YES
| NO
| NO
| NO
| NO
| NO
| NO
| NO
|
DBCS (6) (7) (8)
DBCS-edited
| NO
| NO
| NO
| NO
| YES
| NO
| NO
| NO
| NO
| NO
| YES
|
| Floating-Point (10)
| NO
| NO
| YES
| NO
| NO
| YES
| YES
| NO
| NO
| NO
| NO
|
| Date (6)
| NO
| YES
| YES
| NO
| NO
| NO
| NO
| YES
| NO
| YES
| NO
|
| Time (6)
| NO
| YES
| YES
| NO
| NO
| NO
| NO
| NO
| YES
| YES
| NO
|
| Timestamp (6)
| NO
| YES
| YES
| NO
| NO
| NO
| NO
| YES
| YES
| YES
| NO
|
| National (6)
| YES
| YES
| NO
| NO
| YES
| NO
| NO
| NO
| NO
| NO
| YES
|
Notes to Table 30:
- (1)
- Includes nonnumeric literals
- (2)
- Includes integer numeric literals
- (3)
- Includes noninteger numeric literals
- (4)
- Includes Boolean literals
- (5)
- First character of sending item is moved, regardless of its value
- (6)
- Boolean, DBCS, DBCS-edited, national, internal and external
floating-point, and date-time items are an IBM Extension.
- (7)
- Includes DBCS literals and SPACE.
- (8)
- Includes DBCS data-items.
- (9)
- Figurative constants and nonnumeric literals must consist only of numeric
characters and will be treated as numeric integer fields. The ALL
literal may not be used as a sending item.
+-------------------------------IBM Extension--------------------------------+
- (10)
- Includes floating-point literals, external floating-point data items
(USAGE DISPLAY), and internal floating-point data items (USAGE COMP-1 or USAGE
COMP-2).
+----------------------------End of IBM Extension----------------------------+
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.