Output Conversion

For F-Format output conversion, an arithmetic or string value from the format list of a PUT statement is converted to a fixed-point decimal value that is then rounded and formatted as a character string of w characters containing a value with d fractional digits.

If d = 0, or if d is omitted, the source value is converted to a fixed-point decimal value with no fractional digits, and the resulting integer value is placed, right-justified, in the field of w blank characters with leading zeros suppressed. (The value zero has one zero digit.) For negative values, the first significant digit is preceded by a minus sign. If the value and its sign cannot fit in w characters, the ERROR condition is signaled.

The following results are produced by an F(4) format.

Value     Result
0 boxes0
25 boxes25
-8 boxes-8
13.5 boxes14
17.08 boxes17
1000 1000
-1000 invalid

If d^= 0, the source value is converted to a fixed-point decimal value with d+1 fractional digits. The value is rounded by adding 5 to the last fractional digit; the last fractional digit is then deleted. The resulting value is placed, right-justified, in a field of w characters with leading integral zero digits suppressed by blanks (fractional values and zero have one integral zero digit). The leading digit is preceded by a minus sign if the value is negative. If the value, its decimal point, and its sign cannot fit in w characters, the ERROR condition is signaled. For the maximum precision allowed by Open PL/I, see your Open PL/I User's Guide.

The following results are produced by an F(5,2) format.

Source     Field
0 boxes0.00
-1 -1.00
.005 boxes0.01
.0005 boxes0.00
10 10.00
-10 invalid