[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: File saving problems, Stata 8.2 for Windows, NetWare
Neville Young (email@example.com) asked about a problem saving
a file across a Windows network:
> What seems to be happening is this:
> You save a file, several times in a row, same filename. Itís fine.
> You then do "save as" and try to save it with a different filename. It then
> *sometimes* claims that the new, different filename already exists, and
> fails to save.
> Hereís an example:
> . save "H:\03 Computing\SOFTWARE\Stata\anothername.dta", replace
> file H:\03 Computing\SOFTWARE\Stata\anothername.dta saved
> . save "H:\03 Computing\SOFTWARE\Stata\anothername2.dta"
> file H:\03 Computing\SOFTWARE\Stata\anothername2.dta already exists
> - but in fact the file anothername2.dta did NOT exist. It worked next try,
> with the same name.
I just checked Stata's source code to see in what situations an "r(602)"
error can be returned after a -save- command. There is only one reason
that it is returned.
When Stata tries to save a file, and the 'replace' option has not
been specified, Stata first tries to open the file read-only (using
the standard C function 'open()' to see if it exists. Stata won't
let you overwrite an existing file if the 'replace' option has not
If the C function 'open()' opens the file and successfully returns
a valid handle to that file, Stata will then return an r(602) error
if the 'replace' option has not been specified on -save-. This
is the ONLY way this error can occur.
I have only a guess as to why Windows (or whatever networking software
Neville's site is using) might be returning a valid file handle to
open() when no file exists. Perhaps there is some sort of caching
issue where if a file with that name existed at some point in the past,
but does not exist now, Windows (or whatever netowrking software
Neville's site is using) still thinks it exists and is returning
a valid handle to a file which in reality no longer exists. This is
an issue Neville will need to take up with his network vendor.
It would be interesting to know what happened if the ", replace" option
were always specified with -save-. This might allow Neville to work
around the problem.
* For searches and help try: