Input/Output

FORTRAN-SO

6.3.3 PRINT Statement

The PRINT statement outputs formatted data to the default write unit. It has the format

PRI NT f [,out-list]

where

fis a format identifier

out-listis a list of the data to be written

Note that the keyword 'PRINT' does not necessarily imply the default unit is a line printer or other print device.

The format specifier 'f' has the same meaning as for the READ statement (section 6.3.1.1.2). The list 'out-list' is defined for PRINT exactly as it is for WRITE (section 6.3.2).

Examples:

PRINT 120, PNAME, AVG

120 FORMAT ...

ASSIG N 120 TO OUTFMT

PRINT OUTFMT, PNAME, AVG

120FORMAT ...

6.4Formatted And Unformatted Data Transfer

In the description of the OPEN statement we saw that a file can be connected for formatted or unformatted I/O (section 6.2.1.7). The defaults for the formatting specifier are 'UNFORMATTED' if the file is connected for direct access and 'FOR- MATTED' if the access method is sequential. The formatted or unformatted pro- perty is confirmed by the presence or absence of the format specifier

[FMT =] f

in READ, WRITE, or PRINT statements. in the case of formatted 110, the I/O statement is normally used with a FORMAT statement.

6.4.1 Unformatted Data Transfer

The unit specified in a data-transfer statement involving unformatted data must be an external unit. Data is transferred without editing between the current record of the connected file and items in the 110 list. Exactly one record is read or written.

The number of items in an input list must not exceed the number of values in the record. The type of each value in the record must agree with the type of the cor- responding input list item. The item and its value must also agree in length.

On output, if the file is connected for direct access and the values in the output list do not fill the record, the remainder of the record is undefined.

6-14

Page 74
Image 74
Intel fortran-80 manual Formatted And Unformatted Data Transfer, Print Statement, Print 120, PNAME, AVG