XL Fortran for AIX 8.1

User's Guide


Preconnected and Implicitly Connected Files

Units 0, 5, and 6 are preconnected to standard error, standard input, and standard output, respectively, before the program runs.

All other units can be implicitly connected when an ENDFILE, PRINT, READ, REWIND, or WRITE statement is performed on a unit that has not been opened. Unit n is connected to a file that is named fort.n. These files need not exist, and XL Fortran does not create them unless you use their units.

Note:
Because unit 0 is preconnected for standard error, you cannot use it for the following statements: CLOSE, ENDFILE, BACKSPACE, REWIND, and direct input/output. You can use it in an OPEN statement only to change the values of the BLANK=, DELIM=, or PAD= specifiers.

You can also implicitly connect units 5 and 6 (and *) by using I/O statements that follow a CLOSE:

      WRITE (6,10) "This message goes to stdout."
      CLOSE (6)
      WRITE (6,10) "This message goes in the file fort.6."
      PRINT *, "Output to * now also goes in fort.6."
10    FORMAT (A)
      END

The FORM= specifier of implicitly connected files has the value FORMATTED before any READ, WRITE, or PRINT statement is performed on the unit. The first such statement on such a file determines the FORM= specifier from that point on: FORMATTED if the formatting of the statement is format-directed, list-directed, or namelist; and UNFORMATTED if the statement is unformatted.

Preconnected files also have FORM='FORMATTED', STATUS='OLD', and ACTION='READWRITE' as default specifier values.

The other properties of a preconnected or implicitly connected file are the default specifier values for the OPEN statement. These files always use sequential access.

If you want XL Fortran to use your own file instead of the fort.n file, you can either specify your file for that unit through an OPEN statement or create a symbolic link before running the application. In the following example, there is a symbolic link between myfile and fort.10:

ln myfile fort.10

When you run an application that uses the preconnected file fort.10 for input/output, XL Fortran uses the file myfile instead. The file fort.10 exists, but only as a symbolic link. The following command will remove the symbolic link but will not affect the existence of myfile:

rm fort.10


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]