PDA

View Full Version : Re: [LF] File sharing


Lahey Support
08-15-2003, 01:19 AM
Hello all:

Thanks to those who replied to my query about file sharing. I have made
a
few discoveries that may interest people, so I am posting them.

1. the parameter action='write,denywrite' as suggested by lyoung
with reference to the LF90 Fortran manual does not work in F77L3 - it
gives
a runtime error message.

I've long lost my F77L3 manual so I can't tell if its supposed to work;
however the command action='denywrite' works as suggested,
and that should do the same thing.

2. With or without that parameter, I've discovered that the DOS COPY
command works to read the checkpoint file (at least in WIN98 it does).

For example, DOS command:

COPY A A.BAK

will copy checkpoint file A onto A.BAK, even if the program that is
creating
file A is still running in another window, and with no special ACTION
parameter used. It even results in an updated report on the length of
file
A if you execute a DIR command anytime after copying. I cannot find
any
other DOS command that will touch the file. For example MORE, EDIT
and FC
fail with sharing violations. The failure of EDIT is understandable,
since it probably tries to open the file with write permission, but that
shouldn't apply for the MORE or FC command. You can also copy and paste
the file using Windows explorer.

So with proper use of a Buffer flush, that solves the problem. Now, if
someone understands why COPY can share a file that nothing else can
touch, that would be interesting information. I can't find any
information about SHARE except in an old DOS 5.1 manual where it is
mentioned without any explanation about what it is supposed to do.

Mike Milgram

Michael Milgram wrote:

> Hello all.
>
> Does anyone know how to share files on Windows 95/98 using Fortran?
>
> I have a DOS based program that runs for days on end in a background DOS
> window, writing a checkpoint tape every few hours. If I inspect this
> file from a second DOS window, it always shows length 0 although the
> true length is more like 40MB; if I try to
> copy it to another file I get a sharing violation message. The fact
> that I get a message suggests that there is a way around it, perhaps by
> using some parameter on the open statement in the program, but I can't
> find anything in LF90 or LF95 manual that looks like it might do this.
>
> The problem occurs when WIN98 crashes, which it does infrequently, and I
> have to reboot. I can retrieve the checkpoint file using SCANDISK, but
> it is always the wrong length and therefore unuseable. If I could
> access the file from another window while the big program was running, I
> could write a program that copies the latest version of the checkpoint
> file to a second file every few hours, so it could be retrieved when the
> system crashes. Closing and re-opening the file, or flushing buffers
> from inside the main program is not an option - the program logic is far
> too complex and writes too many intermediate files from the same place
> to allow this. Any ideas would be appreciated.
>
> For other reasons, I have to compile using F77L3, so any ideas that
> would allow me to continue compiling with that compiler would be even
> more appreciated.
>
>
>
>