When an arithmetic or string value is converted to a pictured value, it is first converted to a fixed-point decimal value described by the picture, as explained in the section Picture Data in the chapter Data Types. The decimal value is then edited into a character string of length w, where w is the number of characters in the picture, excluding any 'V' characters.
If the fixed-point decimal value described by the picture is not sufficient to retain all digits to the left of the decimal point, the program may be in error and could produce unpredictable results. Excess fractional digits are truncated.
The fixed-point decimal value is formed into the pictured result value under control of the picture edit characters, as described in Picture Data in the chapter Data Types.
If the fixed-point value is zero and the picture does not contain at least one '9' character, the result is a field of w blanks or w asterisks, depending on which zero-suppression picture characters were used.
Negative values cannot be edited unless the picture contains at least one sign picture character. If this rule is violated, the ERROR condition is signaled.
Value | Picture | Result |
---|---|---|
5.2 | ZZZVZZ | 520 |
0.01 | ZZZVZZ | 01 |
0 | ZZZ | |
1234 | ZZZZV | 1234 |
12345 | 99999 | 12345 |
123 | 99999 | 00123 |
-105.02 | $**,***V.99 | invalid |
-105.02 | $**,***V.99CR | $***105.02CR |
-75 | ––––V–– | -7500 |
75 | ––––V–– | 7500 |
-20 | -999 | -020 |
20 | -999 | 020 |
-275.03 | $$$$$V.99- | $275.03- |
25.01 | $$$$$V.99- | $25.01 |
-7.5 | $$,$$$V.99DB | $7.50DB |
0 | -****V. ** | ******** |
5 | -****V.** | ****5.00 |
-75 | -****V.** | -**75.00 |
.75 | Z.VZZ | 75 |
.75 | ZV.ZZ | .75 |
0 | ZZ$ |