CHAPTER 61

INPUT/OUTPUT

The FORTRAN input/output (I/O) statements transfer data between a processor and external units or within the processor itself. These statements can specify the ex- ternal units to be used, the variables whose values are being entered or output, and the format of I/O data.

The first group of I/O statements are the file-handling statements (OPEN, CLOSE, BACKSPACE, REWIND, ENDFILE). As their names imply, these statements are used for connecting and disconnecting files, positioning files, and marking the end of a file.

The external unit to be used and the list of variables to be input or output is supplied by the READ, WRITE, and PRINT data-transfer statements. When the input or output is formatted, these statements are used with the FORMAT statement.

~~f:~~~~t~~~~~r.~~~~I~~.9:~~~~.~I~Btg1~<l~~t~.*P~~~2t:E~?P:S>~~i~~Intetf:9RjR~N ?~~~;~~~f~rp/~Ptq~$gt;l~~!pp.qr~lif:.~~~'~~Jl9.~~ffJf!J;Jff••jq~ril1s~<:. su broutine~ ·in

s.ectionF.2,2...

Before any of these statements are discussed, the properties of records, files, and units are reviewed. They can be described only in general here, however, since many of the specifics related to them are dependent on the processor or operating environ- ment.

6.1Records, Files, And Units

6.1.1Record Properties

A record is simply a sequence of values or characters. The length of a record is generally the same as the sum (in bytes) of the items written into the record, unless it is stated specifically in a record length specifier (section 6.2.1.8). Records are classified as formatted or unformatted.

A formatted record can be any sequence of characters representable in the pro- cessor (except escape, carriage return, or line feed characters). An unformatted record can be a sequence of values containing both character and noncharacter data. These two kinds of records can only be read or written by formatted and un- formatted I/O statements, respectively.

6.1.2 File Properties

The main properties of a file are:

That is may exist;

That it may have a name;

That it has a position;

That it may be external or internal to the processor;

That it may be accessed sequentially or directly;

That it may have records of specific length (for direct access files);

That it may have formatted or unformatted contents.

6-1

Page 61
Image 61
Intel fortran-80 manual Chapter INPUT/OUTPUT, Records, Files, And Units, Record Properties, File Properties