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.30 ENDFILE Statement<br />

<br />

ENDFILE u<br />

ENDFILE (alist)<br />

where:<br />

u<br />

alist<br />

is an external unit identifier.<br />

is a list of endfile specifiers separated by commas:<br />

[UNIT =] u<br />

IOSTAT = ios<br />

ERR = s<br />

Execution of an ENDFILE statement causes an endfile record to be written to the file connected to the<br />

specified unit. The file is then positioned after the endfile record. If the file may be connected for direct<br />

access, only those records before the endfile record are considered to have been written. Thus, only those<br />

records before the endfile record may be read during subsequent direct access connections to the file.<br />

Endfile Specifiers<br />

[UNIT =] u<br />

IOSTAT = ios<br />

ERR = s<br />

u is an external unit identifier. An external unit identifier is a non-negative integer<br />

expression. If the optional UNIT= specifier is omitted then the specifier must be the first<br />

item in the list of specifiers.<br />

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

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

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

Example:<br />

LOOP<br />

READ( UNIT=7, END=100, FMT=200 )RECORD<br />

WRITE( UNIT=8, FMT=200 )RECORD<br />

ENDLOOP<br />

100 ENDFILE( UNIT=8 )<br />

In the previous example, we illustrate how one might read all the records from one file (unit 7), write them<br />

to another file (unit 8) and then write an endfile record to the end of the file on unit 8.<br />

60 ENDFILE Statement

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

Saved successfully!

Ooh no, something went wrong!