Lahey Support
08-15-2003, 01:19 AM
For Michael Milgram's problem:
If you run a fortran program on a Windows-based machine with SHARE running,
then everything depends on how the fortran program was compiled. Mainly,
whether "SHR" is available as a status value or not and whether it was
used, or whether "READWRITE" is available.
MS fortran 77 will not let you open a file for read, close, and overwrite
within the program if SHARE is active. It stops the overwrite part with
"SHARE VIOLATION".
You can detect whether share is loaded with a DOS call.
I don't think the FLUSH call will help - it only passes the buffer to disk
without updating the directory (and file size).
If you have the source code you must modify the program to use access
"DIRECT" for files which can be overwritten; these files can be used
sequentially for reading and writing fixed unformatted records WITHOUT EVEN
USING the REC=recnumber parameter.
I honestly think you do not have a chance with an existing program unless
you execute in DOS only (boot computer in DOS mode, hit F8 when it says
"loading Windows", select DOS only. And SHARE will kill you again unless
you remove it or not allow it to load.
I have programs where I test for SHARE then either execute a
CALL SYSTEM ('COPY filename filename'C) or else open a new file, copy and
close. You CAN delete a temporary file while SHARE is running, so you use
only temporary files until you copy the last temporary file to a named
(STATUS="KEEP") file. But too bad if it's not your own code.
Terence Wright
>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.
>
>Thanks
>Mike Milgram
>
>
>
If you run a fortran program on a Windows-based machine with SHARE running,
then everything depends on how the fortran program was compiled. Mainly,
whether "SHR" is available as a status value or not and whether it was
used, or whether "READWRITE" is available.
MS fortran 77 will not let you open a file for read, close, and overwrite
within the program if SHARE is active. It stops the overwrite part with
"SHARE VIOLATION".
You can detect whether share is loaded with a DOS call.
I don't think the FLUSH call will help - it only passes the buffer to disk
without updating the directory (and file size).
If you have the source code you must modify the program to use access
"DIRECT" for files which can be overwritten; these files can be used
sequentially for reading and writing fixed unformatted records WITHOUT EVEN
USING the REC=recnumber parameter.
I honestly think you do not have a chance with an existing program unless
you execute in DOS only (boot computer in DOS mode, hit F8 when it says
"loading Windows", select DOS only. And SHARE will kill you again unless
you remove it or not allow it to load.
I have programs where I test for SHARE then either execute a
CALL SYSTEM ('COPY filename filename'C) or else open a new file, copy and
close. You CAN delete a temporary file while SHARE is running, so you use
only temporary files until you copy the last temporary file to a named
(STATUS="KEEP") file. But too bad if it's not your own code.
Terence Wright
>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.
>
>Thanks
>Mike Milgram
>
>
>