The information in this article applies to:
SYMPTOMSWhen a data file is opened as FORM='UNFORMATTED' and ACCESS='APPEND' in Microsoft FORTRAN version 5.1, extra copies of the data file, including beginning-of-file (BOF) and end-of-file (EOF) markers, are added to the file between the existing BOF and EOF markers. This can cause unpredictable or erroneous results during run-time. The following is the most common error message encountered:
STATUSMicrosoft has confirmed this to be a problem in Microsoft FORTRAN version 5.1 for MS-DOS and OS/2. This problem was corrected in FORTRAN PowerStation. MORE INFORMATIONThe following code reproduces the problem:
This program creates an unformatted data file, which causes a BOF
marker (K) to be written to the file, then writes "nam1" to the file.
This causes the ASCII code for the number of bytes contained in the
next record to be written, as appropriate for unformatted files, then
word "nam1" is written and another length byte. An EOF marker (e') is
written to the data file when the file is closed.
When the file is opened a second time, the file pointer is positioned just before the EOF marker, then the entire data file is copied out at that position. The data file now contains two EOF and BOF markers, in addition to two copies of the actual data already written to the file. The run-time then encounters the WRITE statement, and the word "nam2" is written to the file. The data file appears as follows: K*nam1*K*nam1*e'*nam2*e'where * represents char(4), the byte length inserted in unformatted files indicating the record is 4 bytes long. K is the BOF marker, and e' is the EOF marker. In this case, closing or rewinding the file causes the file pointer to be positioned following the second beginning-of-file marker (the second K). Any subsequent READ will then read the word "nam1", followed by the EOF marker (e'), where an EOF error message will be generated. Additional query words: 5.10
Keywords : |
Last Reviewed: November 2, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |