Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Language Reference Manual

Converting other data attributes

Source-to-target rules are given, following this section, for converting data items with the following data attributes:

Changes in value can occur in converting between decimal representations and binary representation. In converting between binary and decimal, the factor 3.32 is used as follows:

A table of CEIL values is provided in Table 22 to calculate these conversions.

Table 22. CEIL (n*3.32) and CEIL (n/3.32) values
n
CEIL
(n*3.32)
n
CEIL
(n/3.32)
1 4 1-3 1
2 7 4-6 2
3 10 7-9 3
4 14 10-13 4
5 17 14-16 5
6 20 17-19 6
7 24 20-23 7
8 27 24-26 8
9 30 27-29 9
10 34 30-33 10
11 37 34-36 11
12 40 37-39 12
13 44 40-43 13
14 47 44-46 14
15 50 47-49 15
16
531
50-53
16
17 57 54-56 17
18 60 57-59 18
19 64 60-63 19
20 67 64-66 20
21 70 67-69 21
22 74 70-73 22
23 77 74-76 23
24 80 77-79 24
25 83 80-83 25
26 87 84-86 26
27 90 87-89 27
28 93 90-92 28
29 97 93-96 29
30 100 97-99 30
31 103 100-102 31
32 107 103-106 32
33 110 107-109 33
    110-112 34
    113-116 35 
Note 1:
While ceil(16*3.32) = 54, the value 53 is used. If it were not, a float decimal(16), when converted to binary, would have to be converted from long floating-point to extended floating-point (because float binary(54) is represented as extended floating-point).  

For fixed-point integer values, conversion does not change the value. For fixed-point fractional values, the factor 3.32 provides only enough digits or bits so that the converted value differs from the original value by less than 1 digit or bit in the rightmost place.

For example, the decimal constant .1, with attributes FIXED DECIMAL (1,1), converts to the binary value .0001B, converting 1/10 to 1/16. The decimal constant .10, with attributes FIXED DECIMAL (2,2), converts to the binary value .0001100B, converting 10/100 to 12/128.


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)