A WRITE, with the O or Z field descriptors in the FORMAT, writes out values as octal or hexadecimal integers, respectively. It writes to a field that is w characters wide, right-justified.
M = 161 WRITE ( *, 8 ) M 8 FORMAT ( Z3 ) END
The letter A appears in output column 2.
Further examples are included in the following table.Table 5-7 Sample Octal/Hex Output Value
Internal (Decimal) Value
External (Octal/Hex) Representation
|O6 O2 O4.3 O4.4 O6||32767 14251 27 27 -32767||D77777 ** D033 0033 *****|
|Z4 Z3.3 Z6.4 Z5||32767 2708 2708 -32767||7FFF A94 DD0A94 ******|
The general rules for octal and hex output are:
Negative values are written as if unsigned; no negative sign is printed.
The external field is filled with leading spaces, as needed, up to the width w.
If the field is too narrow, it is filled with asterisks.
If m is specified, the field is left-filled with leading zeros, to a width of m.