Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!rochester!pt.cs.cmu.edu!sei.cmu.edu!firth
From: firth@sei.cmu.edu (Robert Firth)
Newsgroups: comp.lang.fortran
Subject: Re: end= with no input variables ?
Message-ID: <510@aw.sei.cmu.edu.sei.cmu.edu>
Date: Wed, 7-Jan-87 09:29:29 EST
Article-I.D.: aw.510
Posted: Wed Jan  7 09:29:29 1987
Date-Received: Wed, 7-Jan-87 21:52:19 EST
References: <44400008@hcx1>
Sender: netnews@sei.cmu.edu
Reply-To: firth@bd.sei.cmu.edu.UUCP (PUT YOUR NAME HERE)
Organization: Carnegie-Mellon University, SEI, Pgh, Pa
Lines: 39

In article <44400008@hcx1> daver@hcx1.UUCP writes:
>
>Suppose the following statement is used to read from an empty file:
>
>             read (11, '(i5)', end=10) i
>
>The end= branch should be taken, because an "end-file" record is 
>encountered.
>
>Now suppose no input variable is given:
>
>             read (11, '(i5)', end=10)
>
>Should the end= branch be taken or not (using the same empty file) ?
>I know of 2 compilers which do not take the branch.  Another one does.
>
>The standard describes what happens during a data transfer, but in the
>second example, no data is being transferred.  I see no explicit mention
>of when an end-of-file should be detected except for the vague phrase
>"when a read is executed".

I believe the END= should not be executed.  ANSI X3.9-1978 explains how
an IO data transfer occurs in 12.9.  In particular, these two steps are
executed in this order

	(4) Position the file prior to data transfer

	(5) Transfer data between the file and the entities
	    specified by the input-output list (if any)

The above means an empty IO list is legal.  Section 12.2.3 (File Position)
is explicit that you can validly position at the beginning of an empty file.
Section 12.6 (1) says an end-of-file condition exists if an endfile record
is encountered during the READING of a file.  Put all three together, and
the correct behaviour seems to be that the READ statement is executed, no
data are transferred, the file remains positioned at the beginning, and
control passes on sequentially.

The compiler that takes the branch would appear to be non-compliant.