24.11.2014 Views

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

<strong>Language</strong> <strong>Reference</strong><br />

REC = rn<br />

IOSTAT = ios<br />

ERR = s<br />

rn is an integer expression whose value must be positive. It is the number of the record to<br />

be written when a file is connected for direct access.<br />

is an input/output status specifier. The integer variable or integer array element ios is<br />

defined with zero if no error condition occurs or a positive integer value if an error<br />

condition occurs.<br />

is an error specifier and s is a statement label. When an error occurs, execution is<br />

transferred to the statement labelled by s.<br />

Output list - An output list may contain one or more of the following:<br />

1. A variable name.<br />

2. An array element name.<br />

3. A character substring name.<br />

4. An array name except an assumed-size dummy array.<br />

5. Any other expression except a character expression involving concatenation of an operand<br />

whose length specification is an asterisk in parentheses unless the operand is the symbolic name<br />

of a constant (since the length can be determined at compile time).<br />

6. An implied-DO list of the form:<br />

( dlist, i = e1, e2 [,e3] )<br />

where dlist is composed of one or more of items (1) through (6).<br />

Example:<br />

WRITE( 6, 100 )X, Y, Z<br />

WRITE( UNIT=6, FMT=100 )X, Y, Z<br />

100 FORMAT( 3F10.5 )<br />

WRITE( UNIT=6, FMT=’( 3F10.5 )’ )X, Y, Z<br />

WRITE( 6, ’( 3F10.5 )’ )X, Y, Z<br />

The above gives four examples of formatted WRITE statements. In all cases, the format conversion is<br />

identical but it was specified in different ways. When executed, the effect of all WRITE statements is the<br />

same. The unit number, used here, is 6. There are, in fact, many other ways in which the WRITE statement<br />

could have been written, all of which would have the same effect when executed. We have not shown use<br />

of all the specifiers.<br />

Example:<br />

WRITE( 6, * )X, Y, Z<br />

WRITE( *, * )X, Y, Z<br />

WRITE( UNIT=6, FMT=* )X, Y, Z<br />

WRITE( UNIT=*, FMT=* )X, Y, Z<br />

The above four examples of list-directed formatted output are all equivalent. <strong>Open</strong> <strong>Watcom</strong> <strong>FORTRAN</strong> <strong>77</strong><br />

assumes unit 6 when the unit number identifier is an asterisk (as in the second and fourth examples). In the<br />

examples, the format identifier is an asterisk indicating list-directed formatting.<br />

148 WRITE Statement

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

Saved successfully!

Ooh no, something went wrong!