Rules for Figurative Constants
Rules for Figurative Constants
Remember the following rules when using figurative constants:
-
MOVE and MOVEL operations allow you to move a character figurative constant to a numeric field. The figurative constant is first expanded as a zoned numeric with the size of the numeric field, then converted to packed or binary numeric if needed, and then stored in the target numeric field. The digit portion of each character in the constant must be valid. If not, a decimal data error will occur.
-
Figurative constants are considered elementary items. Except for MOVEA, figurative constants act like a field if used in conjunction with an array. For example: MOVE *ALL’XYZ’ ARR.
If ARR has 4-byte character elements, then each element will contain ‘XYZX’.
-
MOVEA is considered to be a special case. The constant is generated with a length equal to the portion of the array specified. For example:
-
MOVEA *BLANK ARR(X)
Beginning with element X, the remainder of ARR will contain blanks.
-
MOVEA *ALL’XYZ’ ARR(X)
ARR has 4-byte character elements. Element boundaries are ignored, as is always the case with character MOVEA operations. Beginning with element X, the remainder of the array will contain ‘XYZXYZXYZ…’.
-
Note that the results of MOVEA are different from those of the MOVE example above.
- After figurative constants are set/reset to their appropriate length, their normal collating sequence can be altered if an alternate collating sequence is specified.
- The move operations MOVE and MOVEL produce the same result when moving the figurative constants *ALL’x..’, *ALLG’oK1K2i’, and *ALLX’x1..’. The string is cyclically repeated character by character (starting on the left) until the length of the associated field is the same as the length of the string.
- Figurative constants can be used in compare operations as long as one of the factors is not a figurative constant.
- The figurative constants, *BLANK/*BLANKS, are moved as zeros to a numeric field in a MOVE operation.