Intel fortran-80 manual Examples

Models: fortran-80

1 130
Download 130 pages 742 b
Page 72
Image 72
Manual background

Input/Output

FORTRAN-SO

If the asterisk option is selected, 'ctl-list' must not include a record number specifier. If the unit specifier is an internal file, the format specifier must be present, but can- not be an asterisk.

Examples:

READ (2,25) PNAME, AS, HITS

25 FORMAT ...

READ 25, PNAM E, AS, HITS

25 FpRMAT ...

ASSIGN 25 TO INFMT

READ (2,INFMT) PNAME

25FORMAT ...

READ (2, *) PNAM E

6.3.1.1.3Record Number Specifier. The record number specifier is included in 'ctl- list' if and only if the file to be read is connected for direct access. It has the format

REC = recno

where 'recno' is an integer expression whose value is positive. The value of this ex- pression is the number of the record to be read.

Examples:

READ (2, REC = 20)

READ (2, REC = K)

READ (2, REC = K+ 1)

6.3.1.1.4Input/Output Status Specifier. The 110 status specifier, 10STAT, is essentially interpreted as it was for the OPEN statement (section 6.2.1.2). In the case of data-transfer 110 statements, however, the variable 'stname' is also assigned a negative value at end-oF-file.

6.3.1.1.5Error Specifier. The error specifier has the same interpretation as for the OPEN statement (section 6.2.1.3).

6.3.1.1.6End-Of-File Specifier. The format of the end-of-file specifier is

END = stl

where 'stl' is the label of an executable statement in the same program unit as the statement containing this specifier.

When the end-of-file is detected during a read operation, execution of the READ statement terminates, 'stname' is assigned a negative value (6.3.1.1.4), and execu- tion continues with the statement specified by END.

If END is specified, the file must be connected for sequential access.

Example:

READ (2,25,IOSTAT=STFLG,ERR= 1200,END=860) A,S,C

6-12

Page 72
Image 72
Intel fortran-80 manual Examples