Numeric pictures
Numeric pictures allow you to decode and reformat integer and decimal numeric values. A value is interpreted as a numeric value only if its picture string contains numeric picture-control characters.
The input data is first scanned for the number of digits to the
left and right of the decimal point (if any), and for a negative sign
that can either precede or follow the data. The picture string is
then used to reformat the value. The numeric picture-control characters
are 9
, S
, V
, and Z
.
The following list describes the behavior of the numeric picture-control
characters.
- Character
- Definition
- 9
- Replaces the control character with a numeric character
- S
- Replaces the control character with a minus sign if the input value is negative
- V
- Inserts a decimal point
- Z
- Replaces the control character with a numeric character or a leading zero
The following table lists some examples of numeric pictures.
Picture | Input data | Output data | Comment |
---|---|---|---|
9999999 | 123 | 0000123 | Simple reformat |
S999.99 | 123- | -123.00 | Sign controlled on output |
99V99 | 123 | 01.23 | Implicit decimal point |
99.99 | 103.455 | 103.45 | Strip decimals |