Digits and decimal points
The picture characters 9 and V are used in numeric character specifications that represent fixed-point decimal values.
- 9
- Specifies that the associated position in the data item contains
a decimal digit. (Note that the 9 picture specification character
for numeric character data is different from the specification for
character data because the corresponding character cannot be a blank
for character data.) 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). See the following example:
dcl digit picture'9', Count picture'999', XYZ picture '(10)9';An example of use is shown below: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); - V
- Specifies that a decimal point is assumed at this position in
the associated data item. However, it does not specify that an actual
decimal point or decimal comma is inserted. The integer value and
fractional value of the assigned value, after modification by the
optional scaling factor F(±x), are aligned on the V character. Therefore,
an assigned value can be truncated or extended with zero digits at
either end. (If significant digits are truncated on the left, the
result is undefined and the SIZE condition is raised if enabled.)
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.
Consider the following example:dcl Value picture 'Z9V999'; Value = 12.345; dcl Cvalue char(5); Cvalue = Value;Cvalue, after assignment ofValue, contains'12345'.
Table 1 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.
|
|||