HP Fortran Programmer's Reference (September 2007)

I/O formatting
Edit descriptors
Chapter 9258
O (Octal) edit descriptor
The O edit descriptor defines a field for octal data. It provides conversion between an external
octal number and its internal representation.
The syntax for the octal edit descriptor is:
[
r
]O[
w
[.
m
]]
where:
r
is a positive integer constant, specifying the repeat factor.
w
is a positive integer constant, specifying the field width.
m
is a nonnegative integer constant, specifying the minimum number of digits
that must be in the field and forcing leading zeroes as necessary up to the
first nonzero digit. The
m
value is ignored on input. If
m
is not specified, a
default value of 1 is assumed. If
m
is larger than
w
, the field is filled with
w
asterisks.
Input
The presence of too many digits for the integer variable (or list item) to receive produces
undefined results. Legal octal digits are 0 through 7. Plus and minus signs are illegal.
Table 9-20 provides examples of the octal edit descriptors on input.
Output
List items may be of any type, though character variables are output only as the octal
equivalent of their ASCII representation (no length descriptor).
If
w
is greater than the number of converted octal digits (including blanks between words but
excluding leading zeroes), the octal digits are right-justified in the output field. If
w
is less
than the number of converted octal digits, the field is filled with asterisks. This primarily
affects the output of negative values. Because negative values are output in twos complement
Table 9-20 O edit descriptor: input examples
Descriptor Input field (octal) Value stored (octal)
O8 12345670 12345670
O2 77 77
O3 064 64
O8 45r error: illegal character