The information in this article applies to:
SYMPTOMSIf a program compiled under Microsoft FORTRAN version 5.0 or 5.1 writes to a file that has the READ-ONLY attribute set and is OPENed FORM='UNFORMATTED', the run-time system may return the following message: This message may be displayed several times under MS-DOS before the machine finally hangs. Under OS/2, the same error message may be displayed several times before a protection violation is generated. Sample code 1 below illustrates this problem. When attempting to read from a non-existent file OPENed with MODE='READ' and FORM='UNFORMATTED', this same error message may be generated several times and the machine may hang. In OS/2, a protection violation may be generated after the message is displayed several times. Sample code 2 below illustrates this problem. If a file is OPENed MODE='READ' and the program attempts to WRITE to that file, the same run-time error F6421 is generated several times and then the machine may hang. Under OS/2, the same message may be generated several times before producing a protection violation. Sample code 3 below illustrates this problem. CAUSE
Normally, if the run-time system performs an OPEN statement, it first tries
to open the file with the READWRITE attribute; if it fails, it will try
again with MODE='READ'. If the run-time system fails again, it tries to
open the file with MODE='WRITE'. If it fails each time, it will generate a
run-time error or it will run the instructions in the line specified in the
ERR label.
RESOLUTION
A solution to this problem is to set the MODE attribute in the OPEN
statement for unformatted files. If the user is not sure of the present
status of the file to be accessed, the status can be requested using the
INQUIRE statement before attempting to open the desired file.
STATUSMicrosoft has confirmed this to be a problem in Microsoft FORTRAN versions 5.0 and 5.1. This problem was corrected in FORTRAN PowerStation, version 1.0. MORE INFORMATIONSample Code #1The following code generates the F6421 error before hanging the machine or producing a protection violation if the file TEST.DAT is marked with a READ-ONLY attribute:
Solution:
Sample Code #2The following code generates the F6421 error before hanging the machine or producing a protection violation if the file TEST.DAT does not exist:
Sample Code #3The following code generates the F6421 error before hanging the machine or producing a protection violation:
Additional query words: 5.00 5.10 buglist5.00 buglist5.10 fixlist1.00
Keywords : |
Last Reviewed: November 1, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |