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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>FORTRAN</strong> Statements<br />

3. A character substring name.<br />

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

5. 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 (5).<br />

Example:<br />

READ( 5, 100 )X, Y, Z<br />

READ( UNIT=5, FMT=100 )X, Y, Z<br />

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

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

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

The above gives four examples of formatted READ statements, using the first of three supported forms of<br />

the READ statement. In all cases, the format conversion is identical but it was specified in different ways.<br />

When executed, the effect of all READ statements is the same. The unit number that is explicitly used in<br />

this form of the READ statement is unit number 5. There are, in fact, many other ways in which the READ<br />

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

shown the use of all the specifiers.<br />

Example:<br />

READ 100, X, Y, Z<br />

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

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

The above gives two examples of formatted READ statements, using the second of three supported forms of<br />

the READ statement. In both cases, the format conversion is identical but it was specified in different ways.<br />

When executed, the effect of both READ statements is the same. The unit number that is implicitly used in<br />

this form of the READ statement is unit number 5.<br />

Example:<br />

READ( 5, * )X, Y, Z<br />

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

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

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

READ *, X, Y, Z<br />

READ , X, Y, Z<br />

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

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

fifth example, the asterisk is a format identifier indicating list-directed formatting. The fifth and sixth<br />

examples are examples of the second and third forms, respectively, of the READ statement in which <strong>Open</strong><br />

<strong>Watcom</strong> <strong>FORTRAN</strong> <strong>77</strong> assumes unit 5. When the format identifier is an asterisk or when the third form of<br />

the READ statement is used, we call this list-directed list-directed formatting.<br />

READ Statement 125

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

Saved successfully!

Ooh no, something went wrong!