The picture characters 9 and V are used in numeric character specifications that represent fixed-point decimal values.
A string of n 9 picture characters specifies that the item is a nonvarying character-string of length n, each of which is a digit (0 through 9). For example:
dcl digit picture'9',
Count picture'999',
XYZ picture '(10)9';
An example of use is:
dcl 1 Record,
2 Data char(72),
2 Identification char(3),
2 Sequence pic'99999';
dcl Count fixed dec(5);
·
·
·
Count=Count+1;
Sequence=Count;
write file(Output) from(Record);
If no V character appears in the picture specification of a fixed-point decimal value (or in the first field of a picture specification of a floating-point decimal value), a V is assumed at the right end of the field specification. This can cause the assigned value to be truncated, if necessary, to an integer.
The V character cannot appear more than once in a picture specification.
For example:
dcl Value picture 'Z9V999'; Value = 12.345; dcl Cvalue char(5); Cvalue = Value;
Cvalue, after assignment of Value, contains '12345'.
Table 36 shows examples of digit and decimal point characters.
|
Source Attributes |
Source Data (in constant form) |
Picture Specification |
Character Value |
|---|---|---|---|
|
FIXED(5) FIXED(5) FIXED(5) |
12345 12345 12345 |
99999 99999V 999V99 |
12345 12345 undefined |
|
FIXED(5) FIXED(7) FIXED(3) |
12345 1234567 123 |
V99999 99999 99999 |
undefined undefined 00123 |
|
FIXED(5,2) FIXED(7,2) FIXED(5,2) |
123.45 12345.67 123.45 |
999V99 9V9 99999 |
12345 undefined 00123 |
|
Note:
When
the character value is undefined, the SIZE condition is raised. |
|||