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.

Chapter 5.INPUT AND OUTPUTInput, output, and format statements provide the means for transferring data to or from files. Datais transferred as records to or from files. A record is a sequence of data which may be values orcharacters and a file is a sequence of such records. A file may be internal, that is, held in memory,or external such as those held on disk. To access an external file a formal connection must bemade between a unit, for example a disk file, and the required file. An external unit must beidentified either by a positive integer expression, the value of which indicates a unit, or by anasterisk (*) which identifies a standard input or output device.This section describes the types of input and output available and provides examples of input,output and format statements. <strong>The</strong>re are four types of input/output used to transfer data to or fromfiles: unformatted, formatted, list directed, and namelist.‣ unformatted data is transferred between the item(s) in the input/output list (iolist) and thecurrent record in the file. Exactly one record may be read or written.‣ formatted data is edited to conform to a format specification, and the edited data istransferred between the item or items in the iolist, and the file. One or more records may beread or written. Non-advancing formatted data transfers are a variety of formatted I/O wherea portion of a data record is transferred with each input/output statement.‣ list directed input/output is an abbreviated form of formatted input/output that does not usea format specification. Depending on the type of the data item or data items in the iolist,data is transferred to or from the file, using a default, and not necessarily accurate formatspecification.‣ namelist input/output is a special type of formatted data transfer; data is transferred betweena named group (namelist group) of data items and one or more records in a file.5.1. File Access MethodsYou can access files using one of two methods, sequential access, or direct access (randomaccess). <strong>The</strong> access method is determined by the specifiers supplied when the file is opened usingthe OPEN statement. Sequential access files are accessed one after the other, and are written inthe same manner. Direct access files are accessed by specifying a record number for input, and bywriting to the currently specified record on output.<strong>PGI</strong> <strong>Fortran</strong> <strong>Reference</strong> Guide 69

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

Saved successfully!

Ooh no, something went wrong!