!FORMAT s
on the datafile line supplies a Fortran like
FORMAT
statement for reading fixed format files.
A simple example is
!FORMAT(3I4,5F6.2)
which reads 3 integer fields and 5 floating
point fields from the first 42 characters of each data line. A format
statement is enclosed in parentheses and may include 1 level
of nested parentheses, for example, e.g.
!FORMAT(4x,3(I4,f8.2))
Field descriptors, where r is an optional repeat count, are r X
to skip r character positions,
r Aw
to define r consecutive fields of w characters width,
r Iw
to define r consecutive fields of w
characters width, and
r Fw.d
to define r
consecutive fields of w characters width; d indicates where to
insert the decimal point if it is not explicitly present in the
field,
In ASReml, the
A
and
I
field descriptors are treated
identically and simply set the field width. Whether the field is
interpreted alphabetically or as a number
is controlled by the
!A
qualifier.
Other legal components of a format statement are
the
,
character; required to separate fields -
blanks are not permitted in the format.
the
/
character;
indicates the next field is to be read from the next line. However
a
/
on the end of a format to skip a line is not honoured.
BZ
; the default action is to read blank fields as missing values.
*
and
NA
are also honoured as missing values. If you wish
to read blank fields as zeros, include the string
BZ
.
the string
BM
; switches back to 'blank missing' mode.
the string
Tc
; moves the 'last character read' pointer to
line position c so that the next field starts at position c+1.
For example
T0
goes back to the beginning of the line.
the string
D
;
invokes debug mode.
A format showing these components is
!FORMAT(D,3I4,8X,A6,3(2x,F5.2)/4x,BZ,20I1)
and is suitable for
reading 27 fields from 2 data records such as \\