I’m writing a binary file in Fortran using stream access, opened as follows:
Now, at a later stage I want to reopen the file and append additional data to it. I figured the way to do this is to use the position=‘append’ specifier as follows:
With the Intel compiler this works fine. With PGI I get the following runtime error:
Why does this not work with PGI, and what would be the best alternative?
Thanks in advance,
Can you please either post or send to PGI Customer Service (firstname.lastname@example.org) a reproducing example? Also, please include what version of the compiler and OS you’re using.
Note that the first open shouldn’t matter given the error has to with some conflict with the specifiers given in the second open. However I’m not sure what the conflict is. The open statement looks fine to me and when I try it in a simple example, it works as expected.
Thanks for your reply. Here’s the output from pgf95 -V:
pgf95 11.10-0 64-bit target on x86-64 Linux -tp istanbul
The code below generates the following run-time error on my system:
File name = test.bin
In source file binappendtest.f90, at line number 8
integer, parameter :: PR = 8
real(PR) :: tmp(5)
write(500) 4._PR, 5._PR
print *, tmp
end program test
While I’d need to do some digging as to why, this issue seems to have gone away with the 12.6 release. Do you have access to a newer compiler version?
I’ll ask my sysadmin. I’ve found a workaround so it’s not very urgent any more. But I’d still be interested to be updated about this.
I found the TPR, #18677. Looks like prior to 12.6 we disallowed using position with stream access. There was a secondary issue where position couldn’t zero that was fixed in 12.10.