HP Fortran Programmer's Reference (September 2007)

I/O formatting
Edit descriptors
Chapter 9 247
If the file is opened with BLANK='ZERO', nonleading blanks are treated as zeroes. For more
information about the BLANK= specifier, see “OPEN” on page 410. Plus and minus signs,
commas, or any other symbols are not permitted. If a nonbinary digit appears, an error occurs.
The presence of too many digits for the integer variable (or I/O list item) is illegal.
Table 9-7 provides examples of the binary edit descriptor on input.
Output
Unlike input, list items on output may be of any type, though character values are output only
as the binary equivalent of their ASCII representation (without a length descriptor). If
w
is
greater than the number of converted binary digits (excluding leading zeroes), the binary
digits are right-justified in the output field.
If
w
is less than the number of converted binary digits, the field is filled with
w
asterisks. This
primarily affects the output of negative values. Because negative values are output in twos
complement form, their high-order bits are nonzero and cause the field to be filled with
asterisks when
w
is less than the number of binary digits in the entire output value.
The field width required to fully represent the binary value of an item is eight times its size in
bytes. For example, an INTEGER*4 item could require a field
w
of up to 32 characters.
Only 1s and 0s are printed on output.
Table 9-8 provides examples of the binary edit descriptor on output.
Table 9-7 B Edit descriptor: input examples
Descriptor Input field (binary) Value stored (binary)
B8 1111 1111
B8 01111 1111
B4 10101 1010
B8 1.1 error: illegal character
Table 9-8 B Edit descriptor: output examples
Descriptor Internal value Output
B5 27 11011
B8 27
bbb
11011
B8.6 27
bb
011011