f95 -f77 and open

I've encountered a problem with Fortran 95 8.2 patch 121020-02 running on a Solaris 10 x86 platform.

I'm attempting to use the FILEOPT='buffer=x' keyword with an OPEN statement.

While the Fortran User's Guide for Sun Studio 11 found on docs.sun.com states that the FILEOPT keyword is supported by f95, when I attempt to use this keyword the OPEN statement fails to open the file properly, leading to problems later on.

In addition, the compiler does not give any warnings or errors at compilation or runtime with respect to using this keyword as long as I include the -f77 switch.

I'm attempting to migrate the code from one machine to another.

I know this keyword works with an older Sun F77 compiler, because this is the compiler I've been using on the machine I'm migrating from.

I also know that the code works fine by commenting out the FILEOPT keyword, but I'd like to keep using it if at all possible.

Any help anyone could give me would be greatly appreciated.

Thanks

P.S. The open statement is of the form:

[code]open ( lunew, file=infile, status='unknown'

1, fileopt='buffer=1024000' )[/code]

[1189 byte] By [PerryBothron] at [2007-11-26 9:27:59]
# 1

> when I attempt to use this

> keyword the OPEN statement fails to open the file

> properly, leading to problems later on.

What are the symptoms? This ought to work, I think (though I haven't scrutinized your OPEN statement to see if you've done anything wrong).

Iain

igb at 2007-7-7 0:08:38 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 2

> What are the symptoms? This ought to work, I think

> (though I haven't scrutinized your OPEN statement to

> see if you've done anything wrong).

The symptoms...

Well, the OPEN statement appears to work correctly (since no errors are given at runtime) and the program continues execution. However, later on when the file that was suppposedly opened is read by the program, it has zero length.

I've already verified that the file supposedly being opened and read exists and is the file that I want opened and read.

Jon

PerryBothron at 2007-7-7 0:08:38 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 3
I'm not sure what's going on here, but you should be able to resolve the problem by adding "position='rewind'" to the OPEN statement.
igb at 2007-7-7 0:08:38 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 4

> I'm not sure what's going on here, but you should be

> able to resolve the problem by adding

> "position='rewind'" to the OPEN statement.

I tried adding the "position='rewind' " to all the open statements, but the problem remains, exactly as before. Just to be sure I tried the position keyword before and after the fileopt keyword, but to no avail.

PerryBothron at 2007-7-7 0:08:38 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 5
That's puzzling. What happens if you put a REWIND statement immediately after the OPEN statement?
igb at 2007-7-7 0:08:38 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 6

Never mind, I see what is happening. The system is treating the OPEN statement as if you had specified both fileopt='eof' and fileopt='nopad' in addition to fileopt='buffer=..'. The position='rewind' works around the first problem, but not the second. I don't see a workaround for the second problem (other than just omitting the fileopt='buffer=...').

I have filed a bug relating to this: 6460841.

igb at 2007-7-7 0:08:38 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 7
Thanks for you help.For the time being, I'll comment out the FILEOPT keyword.
PerryBothron at 2007-7-7 0:08:38 > top of Java-index,Development Tools,Solaris and Linux Development Tools...