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>Language</strong> <strong>Reference</strong><br />

Example:<br />

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

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

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

The above gives two examples of the PRINT statement. In both cases, the format conversion is identical<br />

but it was specified in different ways. When executed, the effect of both PRINT statements is the same.<br />

Example:<br />

PRINT ’(1X,100A1)’, (’*’,I=1,J)<br />

The above example illustrates a technique for producing histograms using the implied DO-loop. Each time<br />

this statement is executed, a number of asterisks are printed, depending on the value of J.<br />

Notes:<br />

1. The PRINT statement is implicitly a formatted output statement.<br />

2. The unit number that is implicitly used in the PRINT statement is unit number 6.<br />

3. If no output list is specified then the effect of the PRINT statement is to produce one or more<br />

records whose characters are all blanks.<br />

4. <strong>FORTRAN</strong> <strong>77</strong> leaves the format of output in list-directed formatting to the discretion of <strong>Open</strong><br />

<strong>Watcom</strong> <strong>FORTRAN</strong> <strong>77</strong>. Hence other <strong>FORTRAN</strong> compilers may produce different results. If<br />

the format of output must be consistent from one compiler to the next then list-directed<br />

formatting should not be used.<br />

5. An implication of point (6) above is that nesting of implied-DO lists is permitted. For example,<br />

the output list<br />

( (A(I,J), B(I,J), J = 1, 5), I = 1, 10 )<br />

may be broken down into the following components:<br />

A(I,J), B(I,J)<br />

(....dlist1...., J = 1, 5)<br />

( .....dlist2..............., I = 1, 10 )<br />

For more information on input/output, see the chapter entitled "Input/Output" on page 215. For more<br />

information on formatted input/output, see the chapter entitled "Format" on page 225.<br />

120 PRINT Statement

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

Saved successfully!

Ooh no, something went wrong!