The rules for using numeric picture data are as follows:
- A numeric picture cannot contain more than one sign character ('+', '–', 'S', 'T', 'I', 'R', 'CR', or 'DB') unless all such
sign characters are part of a drifting string.
- When a zero value is assigned to a numeric pictured variable and the numeric picture does not contain at least one '9', the
entire value is filled with blanks or with asterisks (*), depending on which zero-suppression character was used.
- When a nonzero value is assigned to a numeric pictured variable, and the 'V' is followed by zero-suppression characters or
by part of a drifting string, the 'V' stops zero suppression. For example:
DECLARE A PICTURE 'ZZZV.ZZ';
DECLARE B PICTURE '***V.**CR';
In this example, a value of . 01 assigned to A and B produces
and .
. A value of zero assigned to A and B produces
and ********.
- If a 'V' is not given, a 'V' is implied at the rightmost end of the numeric picture.
- Each '9', 'Z', or '*' is considered to be a digit of precision. Within a drifting string each 'S', '+', '–', or '$', except
the first one, is considered to be a digit of precision. All digits of precision following the 'V' are fractional digits.
For example:
DECLARE A PICTURE 'ZZZV.ZZ'
DECLARE B PICTURE '---V.z--'
In this example, A has a precision of (5,2), while B has a precision of (4,2).
- Negative values cannot be assigned to a numeric pictured variable unless the picture contains a 'CR', 'DB', '–', or 'S'. An
error condition is signaled if a negative value is assigned to a numeric pictured variable that does not contain 'S', '+',
'–', 'T', 'I', 'R', 'CR', or 'DB'.
- Values assigned to numeric pictured variables are truncated and aligned with the `V' as they would be when assigned to a fixed
decimal variable of the equivalent precision.
- Used in contexts that expect an arithmetic value, or used with a relational operator, numeric pictured values are converted
to fixed-point decimal values with a precision
p and
q that are determined by the numeric picture.
- A numeric pictured value is operated upon as if it were a character-string value only when it is assigned to a character-string
variable, and when it is an operand of the concatenate operator or of a built-in function that expects character-string operands.
In all other contexts, numeric pictured values are operated upon as if they were fixed-point decimal values.
Following are more examples of picture format output.