24.05.2014 Views

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

v<br />

Files on sequential-access devices (such as pipes, terminals, sockets, and tape<br />

drives)<br />

To avoid the possibility of damaging the file, keep the following points in<br />

mind:<br />

v The second and subsequent OPEN statements <strong>for</strong> the same file can only be<br />

<strong>for</strong> reading.<br />

v If you initially opened the file <strong>for</strong> both input and output purposes<br />

(ACTION=’READWRITE’), the unit connected to the file by the first OPEN<br />

becomes read-only (ACCESS=’READ’) when the second unit is connected.<br />

You must close all of the units that are connected to the file and reopen the<br />

first unit to restore write access to it.<br />

v Two files are considered to be the same file if they share the same device<br />

and i-node numbers. Thus, linked files are considered to be the same file.<br />

multconnio={tty | nulldev | combined | no }<br />

Enables you to connect a device to more than one logical unit. You can then<br />

write to, or read from, more than one logical unit that is attached to the same<br />

device. The suboptions are as follows:<br />

combined<br />

Enables you to connect a combination of null and TTY devices to more<br />

than one logical unit.<br />

nulldev<br />

Enables you to connect the null device to more than one logical unit.<br />

tty Enables you to connect a TTY device to more than one logical unit.<br />

Note: Using this option can produce unpredictable results.<br />

In your program, you can now specify multiple OPEN statements that<br />

contain different values <strong>for</strong> the UNIT parameters but the same value <strong>for</strong><br />

the FILE parameters. For example, if you have a symbolic link called<br />

mytty that is linked to TTY device /dev/tty, you can run the following<br />

program when you specify the multconnio=tty option:<br />

PROGRAM iotest<br />

OPEN(UNIT=3, FILE=’mytty’, ACTION="WRITE")<br />

OPEN(UNIT=7, FILE=’mytty’, ACTION="WRITE")<br />

END PROGRAM iotest<br />

<strong>Fortran</strong> preconnects units 0, 5, and 6 to the same TTY device. Normally,<br />

you cannot use the OPEN statement to explicitly connect additional units<br />

to the TTY device that is connected to units 0, 5, and 6. However, this is<br />

possible if you specify the multconnio=tty option. For example, if units 0,<br />

5, and 6 are preconnected to TTY device /dev/tty, you can run the<br />

following program if you specify the multconnio=tty option:<br />

PROGRAM iotest<br />

! /dev/pts/2 is your current tty, as reported by the ’tty’ command.<br />

! (This changes every time you login.)<br />

CALL SETRTEOPTS (’multconnio=tty’)<br />

OPEN (UNIT=3, FILE=’/dev/pts/2’)<br />

WRITE (3, *) ’hello’ ! Display ’hello’ on your screen<br />

END PROGRAM<br />

namelist={new | old}<br />

Determines whether the program uses the <strong>XL</strong> <strong>Fortran</strong> new or old (Version 1)<br />

NAMELIST <strong>for</strong>mat <strong>for</strong> input and output. The <strong>Fortran</strong> 90 and <strong>Fortran</strong> 95<br />

standards require the new <strong>for</strong>mat.<br />

Editing, Compiling, Linking, and Running <strong>XL</strong> <strong>Fortran</strong> Programs 57

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

Saved successfully!

Ooh no, something went wrong!