HP Fortran Programmer's Reference (September 2007)

I/O formatting
Edit descriptors
Chapter 9244
A and R (character) edit descriptors
The A and R edit descriptors define fields for character data. The A edit descriptor specifies
left-justification, and the R edit descriptor specifies right-justification.
The R edit descriptor is an HP extension.
The syntax for the character edit descriptors is:
[
r
]A[
w
]
[
r
]R[
w
]
where:
r
is a positive integer constant, specifying the repeat factor.
w
is the field width. If
w
is not specified, the default is the length in bytes of the
corresponding I/O list item.
As a portability extension, the list item can be of any data type.
When the A and R edit descriptors are used for input and output, the results can differ
according to whether the width (
w
) specified for the edit descriptor is less than, greater than,
or equal to the length of the I/O list item. The results on input are summarized in Table 9-3;
the results on output are summarized in Table 9-4.
Table 9-3 Contents of character data fields on input
Descriptor
Width/length
relationship
Result
A width < length Data is left-justified in
variable, followed by blanks.
width >= length Data is taken from rightmost
characters in the field.
R width < length Data is right-justified in
variable, preceded by nulls.
width >= length Data is taken from rightmost
characters in the field.