next up previous contents
Next: WRITE Statement Up: Input / Output Previous: OPEN Statement

 

READ Statement

Syntax (not all the specifiers can be used at the same time,)

 
READ([UNIT=]< unit >, [FMT=]< format >, IOSTAT=< int-variable >, ERR=< label >, &

END=< label >, EOR=< label >, ADVANCE=< advance-mode >, REC=< int-expr >, &

SIZE=< num-chars >) < output-list >

where

Consider,

    READ(14,FMT='(3(F10.7,1x))',REC=iexp) a,b,c

here, the record specified by the integer iexp is read -- this record should contain 3 real numbers separated by a space with 10 column and 7 decimal places. The values will be placed in a, b and c.

  READ(*,'(A)',ADVANCE='NO',EOR=12,SIZE=nch) str

Since non-advancing output has been specified, the cursor will remain on the same line as the string is read. Under normal circumstances (default advancing output) the cursor would be positioned at the start of the next line. Note the explicit format descriptor. SIZE reurns the length of the string and EOR= specifies an destination if an end-of-record is encountered.

Return to corresponding overview page gif


next up previous contents
Next: WRITE Statement Up: Input / Output Previous: OPEN Statement

©University of Liverpool, 1997
Wed May 28 20:20:27 BST 1997
Not for commercial use.