The MOVEL operation transfers characters from factor 2 to the result
field. Moving begins with the leftmost character in factor 2. You
cannot specify resulting indicators if the result field is an array.
You can specify them if the result field is an array element, or a
non-array field.
When data is moved to a numeric field, the sign (+ or -) of the
result field is retained except when factor 2 is as long as or longer
than the result field. In this case, the sign of factor 2 is used
as the sign of the result field.
Factor 1 can contain a date or time format to specify the format
of a character or numeric field that is the source or target of the
operation.For
information on the formats that can be used see Date Data Type, Time Data Type, and Timestamp Data Type.
If the source or target is a character field, you may optionally
indicate the separator following the format in factor 1. Only separators
that are valid for that format are allowed.
If factor 2 is *DATE or UDATE and the result is a Date field, factor
1 is not required. If factor 1 contains a date format it must be compatible
with the format of *DATE or UDATE in factor 2 as specified by the
DATEDIT keyword on the control specification.
If factor 2 is longer than the result field, the excess rightmost
characters of factor 2 are not moved. If the result field is longer
than factor 2, the excess rightmost characters in the result field
are unchanged, unless padding is specified.
Float numeric fields and literals are not allowed as Factor 2 or
Result-Field entries.
If factor 2 is UCS-2 and the result field is character, or if factor
2 is character and the result field is UCS-2, the number of characters
moved is variable since the character data may or may not contain
shift characters and graphic characters. For example, five UCS-2 characters
can convert to:
Five single-byte characters
Five double-byte characters
A combination of single-byte and double-byte characters with shift
characters separating the modes
If the resulting data is too long to fit the result field, the
data will be truncated. If the result is single-byte character, it
is the responsibility of the user to ensure that the result contains
complete characters, and contains matched SO/SI pairs.
A summary of the rules for MOVEL operation for four conditions
based on field lengths:
Factor 2 is the same length as the result field:
If factor 2 and the result field are numeric, the sign is moved
into the rightmost position.
If factor 2 is numeric and the result field is character, the
sign is moved into the rightmost position.
If factor 2 is character and the result field is numeric, a minus
zone is moved into the rightmost position of the result field if the
zone from the rightmost position of factor 2 is a hexadecimal D (minus
zone). However, if the zone from the rightmost position of factor
2 is not a hexadecimal D, a positive zone is moved into the rightmost
position of the result field. Digit portions are converted to their
corresponding numeric characters. If the digit portions are not valid
digits, a data exception error occurs.
If factor 2 and the result field are character, all characters
are moved.
If factor 2 and the result field are both graphic or UCS-2, all
graphic or UCS-2 characters are moved.
If factor 2 is graphic and the result field is character, one
graphic character will be lost, because 2 positions (bytes) in the
character result field will be used to hold the SO/SI inserted by
the compiler.
If factor 2 is character and the result field is graphic, the
factor 2 character data must be completely enclosed by one single
pair of SO/SI. The SO/SI will be removed by the compiler before moving
the data to the graphic result field.
Factor 2 is longer than the result field:
If factor 2 and the result field are numeric, the sign from the
rightmost position of factor 2 is moved into the rightmost position
of the result field.
If factor 2 is numeric and the result field is character, the
result field contains only numeric characters.
If factor 2 is character and the result field is numeric, a minus
zone is moved into the rightmost position of the result field if the
zone from the rightmost position of factor 2 is a hexadecimal D (minus
zone). However, if the zone from the rightmost position of factor
2 is not a hexadecimal D, a positive zone is moved into the rightmost
position of the result field. Other result field positions contain
only numeric characters.
If factor 2 and the result field are character, only the number
of characters needed to fill the result field are moved.
If factor 2 and the result field are graphic or UCS-2, only the
number of graphic or UCS-2 characters needed to fill the result field
are moved.
If factor 2 is graphic and the result field is character, the
graphic data will be truncated and SO/SI will be inserted by the compiler.
If factor 2 is character and the result is graphic, the character
data will be truncated. The character data must be completely enclosed
by one single pair of SO/SI.
Factor 2 is shorter than the result field:
If factor 2 is either numeric or character and the result field
is numeric, the digit portion of factor 2 replaces the contents of
the leftmost positions of the result field. The sign in the rightmost
position of the result field is not changed.
If factor 2 is either numeric or character and the result field
is character data, the characters in factor 2 replace the equivalent
number of leftmost positions in the result field. No change is made
in the zone of the rightmost position of the result field.
If factor 2 is graphic and the result field is character, the
SO/SI are added immediately before and after the graphic data. This
may cause unbalanced SO/SI in the character field due to residual
data in the field, but this is users' responsibility.
Notice that when moving from a character to graphic field, the
entire character field should be enclosed in SO/SI. For example, if
the character field length is 8, the character data in the field should
be "oAABB␢␢i" and not "oAABBi␢␢".
Factor 2 is shorter than the result field and P is specified in
the operation extender field:
The move is performed as described above.
The result field is padded from the right. See Move Operations for
more information on the rules for padding.
When moving variable-length character, graphic,
or UCS-2 data, the variable-length field works in exactly the same
way as a fixed-length field with the same current length. A
MOVEL operation does not change the length of a variable-length result
field. For examples, see Figures Figure 4 to Figure 9.