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>FORTRAN</strong> Statements<br />

7. A NAMELIST name, indicating namelist-directed formatting.<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 symbol name of<br />

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 />

CHARACTER*5 S<br />

COMPLEX C<br />

S = ’Hello’<br />

I = 123<br />

X = 12.5<br />

C = (12.5,4.58)<br />

PRINT *, S, I, X, C<br />

END<br />

The above example illustrates list-directed formatting using the PRINT statement. The asterisk specifies<br />

that the variables in the output list are to be displayed in some format that is appropriate to the type of the<br />

variable (hence the term "list-directed"). The CHARACTER variable S is printed using a suitable A format<br />

descriptor. The INTEGER variable I is printed using a suitable I format descriptor. The REAL variable X<br />

is printed using a suitable G format descriptor. The COMPLEX variable C is printed using a suitable G<br />

format descriptor and is displayed with enclosing parentheses and a comma. Output from the above<br />

program would resemble the following.<br />

Hello 123 12.5000000 (12.5000000,4.5799999)<br />

Example:<br />

CHARACTER*5 S<br />

COMPLEX C<br />

S = ’Hello’<br />

I = 123<br />

X = 12.5<br />

C = (12.5,4.58)<br />

PRINT, S, I, X, C<br />

END<br />

The above example illustrates a <strong>Open</strong> <strong>Watcom</strong> <strong>FORTRAN</strong> <strong>77</strong> extension of list-directed formatting using<br />

the PRINT statement. The asterisk is omitted but the results are exactly the same as in the previous<br />

example.<br />

PRINT Statement 119

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

Saved successfully!

Ooh no, something went wrong!