10.07.2015 Views

PGI Fortran Reference manual - The Portland Group

PGI Fortran Reference manual - The Portland Group

PGI Fortran Reference manual - The Portland Group

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Input and OutputFiles may contain one of two types of records, fixed length records or variable length records.To specify the size of the fixed length records in a file, use the RECL specifier with the OPENstatement. RECL sets the record length in bytes.<strong>The</strong> units depend on the value of the FORTRANOPT environment variable. If the value is vaxio,then the record length is in units of 32-bit words. If FORTRANOPT is not defined, or its value issomething other than vaxio, then the record length is always in units of bytes.RECL can only be used when access is direct.A record in a variable length formatted file is terminated with \n. A record in a variable lengthunformatted file is preceded and followed by a word indicating the length of the record.5.1.1. Standard Preconnected UnitsCertain input and output units are predefined, depending on the value of compiler options.<strong>The</strong> <strong>PGI</strong> <strong>Fortran</strong> compilers –Mdefaultunit option tells the compiler to treat "*" as asynonym for standard input for reading and standard output for writing. When the option is –Mnodefaultunit, the compiler treats "*" as a synonym for unit 5 on input and unit 6 onoutput.5.2. Opening and Closing Files<strong>The</strong> OPEN statement establishes a connection to a file. OPEN allows you to do any of thefollowing‣ Connect an existing file to a unit.‣ Create and connect a file to a unit.‣ Create a file that is preconnected.‣ Establish the access method and record format for a connection.OPEN has the form:OPEN (list)where list contains a unit specifier of the form:[UNIT=] uwhere u, an integer, is the external unit specifier.In addition list may contain one of each of the specifiers shown in Table 16.5.2.1. Direct Access FilesIf a file is connected for direct access using OPEN with ACCESS='DIRECT', the record lengthmust be specified using RECL=. Further, one of each of the other specifiers may also be used.Any file opened for direct access must be via fixed length records.In the following example:‣ A new file, book.dat, is created and connected to unit 12 for direct formatted input/outputwith a record length of 98 characters.‣ Blank values are ignored in numeric values.<strong>PGI</strong> <strong>Fortran</strong> <strong>Reference</strong> Guide 70

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!