ADVANCE = 'NO' (default is 'YES') EOR = eor_label (optional, READ only) SIZE = size (optional, READ only)An example shows how to read a record three characters at a time, and to take action if there are fewer than three left in the record:
CHARACTER(3) key INTEGER unit, size READ (unit, '(A3)', ADVANCE='NO', SIZE=size, EOR=66) key : ! key is not in one record 66 key(size+1:) = '' :and how to keep the cursor positioned after a prompt:
WRITE (*, *, ADVANCE='NO') 'Enter next prime number:' READ (*, '(I10)') prime_number
0.0217 --> 21.70E-03 (EN9.2)
0.0217 --> 2.17E-02 (ES9.2)
For entities of derived types, the programmer must elaborate a format for the ultimate components:
TYPE string INTEGER length CHARACTER(LEN=20) word END TYPE string TYPE(string) :: text READ(*, '(I2, A)') text
POSITION= 'ASIS' 'REWIND' 'APPEND' ACTION = 'READ' 'WRITE' 'READWRITE' DELIM = 'APOSTROPHE' 'QUOTE' 'NONE' PAD = 'YES' 'NO'and on the INQUIRE there are also
READ = } WRITE = }'YES' 'NO' 'UNKNOWN' READWRITE= }Finally, inquiry by I/O list (unformatted only) is possible:
INQUIRE (IOLENGTH = length) item1, item2,...and this is useful to set RECL, or to check that a list is not too long. It is in the same processor-dependent units and thus is a portability aid.