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...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Input and OutputSpecifierSIGN=specifierDescriptionWhere specifier is a character expression that controls the optional pluscharacters in formatted numeric output. <strong>The</strong> value can be SUPPRESS, PLUS,PROCESSOR_DEFINED, or UNDEFINED.A unit may be the subject of a CLOSE statement from within any module. If the unit specifieddoes not exist or has no file connected to it, the use of the CLOSE statement has no effect.Provided the file is still in existence it may be reconnected to the same or a different unit afterthe execution of a CLOSE statement. Note that an implicit CLOSE is executed when a programstops.In the following example the file on UNIT 6 is closed and deleted.CLOSE(UNIT=6,STATUS='DELETE')5.3. Data Transfer StatementsOnce a unit is connected, either using a preconnection, or by executing an OPEN statement, datatransfer statements may be used. <strong>The</strong> available data transfer statements include: READ, WRITE,and PRINT. <strong>The</strong> general form for these data transfer statements is shown in Chapter 3 <strong>Fortran</strong>Statements; refer to that section for details on the READ, WRITE and PRINT statements andtheir valid I/O control specifiers.5.4. Unformatted Data TransferUnformatted data transfer allows data to be transferred between the current record and the itemsspecified in an input/output list. Use OPEN to open a file for unformatted output:OPEN (2, FILE='new.dat', FORM='UNFORMATTED')<strong>The</strong> unit specified must be an external unit.After data is transferred, the file is positioned after the last record read or written, if there is noerror condition or end-of-file condition set.Unformatted data transfer cannot be carried out if the file is connected for formatted input/output.<strong>The</strong> following example shows an unformatted input statement:READ (2, ERR=50) A, B‣ On output to a file connected for direct access, the output list must not specify more valuesthan can fit into a record. If the values specified do not fill the record the rest of the record isundefined.‣ On input, the file must be positioned so that the record read is either an unformatted record oran endfile record.‣ <strong>The</strong> number of values required by the input list in the input statement must be less than orequal to the number of values in the record being read. <strong>The</strong> type of each value in the recordmust agree with that of the corresponding entity in the input list. However one complex<strong>PGI</strong> <strong>Fortran</strong> <strong>Reference</strong> Guide 73

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

Saved successfully!

Ooh no, something went wrong!