From: CSBVAX::CSBVAX::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 10-DEC-1988 22:59 To: MRGATE::"ARISIA::EVERHART" Subj: Re: VMS FORTRAN and WRITE FILE sharing Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Sat, 10 DEC 88 14:21:41 PDT Received: from CitHex.Caltech.Edu by KL.SRI.COM with TCP; Sat, 10 Dec 88 12:24:56 PST Date: Sat, 10 Dec 88 11:54:14 PST From: carl@CitHex.Caltech.Edu (Carl J Lydick) Message-Id: <881210115414.148@CitHex.Caltech.Edu> Subject: Re: VMS FORTRAN and WRITE FILE sharing In-Reply-To: Your message <8812091722.aa12014@accuvax.nwu.edu> dated 9-Dec-1988 To: CHOJNACKI@vaxmfg.tech.nwu.edu, info-vax@CitHex.Caltech.Edu > Has anyone ever tried to write to shared files in fortran, then read from > them whilst they are still open. I do a OPEN(UNIT=10, FILE="MYFILE", > STATUS="NEW", SHARED), that compiles ok, and every once in a while a do the > recommended UNLOCK 10 as the manual states (even though it claims this is > for read unlocks). Anyway, after the program has run, written to this file > and has already done an UNLOCK, and I do a $ TYPE filename from DCL, I get > nothing. (If I do not open the file in SHARED mode, VMS of course > complaines that the file is open by another user, but in this case, since > it is shared, VMS says nothing.) The problem is that the FORTRAN run-time I/O routines don't ask RMS to flush its output buffers; the reason a TYPE command doesn't produce any output is that the data hasn't made it to disk yet. You can force a flush of the output to a file open on logical unit number L with the FORTRAN statement: CALL SYS$FLUSH(%VAL(FOR$RAB(L))) where both L and FOR$RAB are declared to be integers variables (actually, since in this case you're never assigning the result of the call to FOR$RAB to anything, the compiler won't apply a CVTFL to it even if you don't declare it.