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

2.6 AT END Statement<br />

AT END DO<br />

[: block-label]<br />

or<br />

AT END, stmt<br />

where:<br />

stmt<br />

is an executable statement other than an AT END statement.<br />

The AT END control statement is an extension of the END= option of the READ statement for sequential<br />

files. It allows a statement or a block of code following the READ statement to be executed when an<br />

end-of-file condition is encountered during the read. The AT END statement or block is by-passed if no<br />

end-of-file occurs. It is not valid to use this control statement with direct-access or internal files. It is not<br />

valid to use this statement when END= is also specified in the READ statement. The AT END statement or<br />

block must immediately follow the READ statement to which it applies.<br />

Example:<br />

READ( UNIT=1, FMT=’(I5,F10.4)’ ) I, X<br />

AT END DO<br />

PRINT *, ’END-OF-FILE ENCOUNTERED ON UNIT 1’<br />

EOFSW = .TRUE.<br />

END AT END<br />

The second form of the AT END statement is illustrated below.<br />

Example:<br />

READ( UNIT=1, FMT=’(F10.4)’ ) X<br />

AT END, EOFSW = .TRUE.<br />

For more information, see the chapter entitled "Program Structure Control Statements" on page 193.<br />

18 AT END Statement

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

Saved successfully!

Ooh no, something went wrong!