Error when trying to open a file for writing

When trying execute the following line of code:

open(unit=3,file=calname,status='new',form='unformatted')

I am getting the following error:

PGFIO/stdio: No such file or directory
PGFIO-F-/OPEN/unit=3/error code returned by host stdio - 2.

The directory is present, and the permissions allow for writing, so I don’t understand why I am getting this error. Thanks!

Hi,

I am not sure what could be the problem. Below is an example program I try and it seems to run. If you can post your small program that causes the error,perhaps we can tell what goes wrong.

Example program:

program testme
integer ifile
character*8 calname
calname=‘abc’
ifile=8

open(file=calname,status=“new”,form=“unformatted”, unit=3)
write(3) ifile
close (3)

end

Hongyon

That’s true. calname needs to be defined. For example:

calname = ‘out.txt’

Open(unit=3,file=calname,status=“unknown”)

I tend to use the status=“unknown” more than “new” or “old.” Seems to run and compile more stabily, if that’s a word.