cray-fortran cft77

Jerry Berkman jerry at violet.berkeley.edu
Tue Nov 7 10:34:38 AEST 1989


In article <8911031050.AA02617 at reason.psc.edu> ZRTA at DS0RUS1I.BITNET (Bernhard Bauer) writes:

> Yesterday, 11.02.89 we switched from unicos 4.0. to unicos 5.0.7
>and we did also a compiler switch from cft77.3.0 to cft77.3.1.
>A user, who had the following peace of fortran code which
>was running well with cft77.3.0 claimed that his program
>resulted in an error after we had switched the compiler.

>      OPEN(10,FILE='ERGEB',STATUS='OLD')
>      READ (10,*,END=25) (LES(J),J=1,1000000)
>   25 CONTINUE
>      CLOSE (10)

>obviously the user wants to read a lot of data and he does'nt know
>how much records his file contains. Therfore he uses the end-clause.
>I told the user to change the READ-statement in the following way:

>      READ (10,*,END=25,ERR=25) (LES(J),J=1,1000000)

>and it worked.

There must have been a change in the I/O library.  The FORTRAN standard states:

	"If an error condition of an end-of-file condition occurs
	 during execution of a READ statement, execution of the
	 READ statement terminates and the entities specified by the
	 input list and implied-DO-variables in the input list
	 become undefined." (ANSI X-3.9-1978, section 12.6)

So you shouldn't use J or the values in LES after an end-of-file
termination of the read.  There are two safe ways to do it:

   1.  Since you are using a list directed read, you can add
	a "/" after the data in file ERGEB to stop the read
	without using the ERR= and END= branches.
or:
   2.   Read one element at a time:
	      OPEN(10,FILE='ERGEB',STATUS='OLD')
	      do 20 j=1,1000000
	         READ (10,*,end=25) LES(j)
	   20 continue
	   25 CLOSE (10)


> Another Problem:
>Another user has an INPUT file which contains 10 records.
>He reads five records and then he writes an end of file.
>However, if you have a look at that file, you have the original
>ten records. The file appeares to be unchanged.	

> Are there more cray users who have observed such I/O problems?

Cray does not truncate files if you write less than already
existed in a file, at least for ASCII text files.
We submitted a Software Problem Report to Cray a while ago and
are still waiting for a response.

Truncating involves setting the byte count correctly and releasing
unneeded disk blocks.  Currently neither is done (we are running
UNICOS 4.0).  For FORTRAN programs to work correctly, only the
byte count need be set correctly.  We have submitted a software
problem report and have been waiting for an answer.


>Bernhard Bauer
>systems programmer
>at the university of stuttgart
>germany
>Acknowledge-To: <ZRTA at DS0RUS1I>

	- Jerry Berkman



More information about the Comp.unix.cray mailing list