FIX: No Check for OPENing Same File with Different PATH

ID: Q84624


The information in this article applies to:
  • Microsoft FORTRAN for MS-DOS, versions 4.0, 4.01, 4.1, 5.0
  • Microsoft FORTRAN for OS/2, versions 4.0, 4.01, 4.1, 5.0


SYMPTOMS

In a Microsoft FORTRAN program, the same file may not be connected to more than one unit at a time. However, programs compiled with Microsoft FORTRAN version 4.0, 4.01, 4.1, or 5.0 can open files with the same filename but with a different path specification without generating the expected error.


STATUS

Microsoft has confirmed this to be a problem in the FORTRAN compiler versions 4.0, 4.01, 4.1, and 5.0. This problem was corrected in Microsoft FORTRAN 5.1.


MORE INFORMATION

The code below should generate the following error:

run-time error F6413: OPEN(Test.Dat)
- file already connected to a different unit
The error should be generated on the second OPEN statement; however, with versions earlier than FORTRAN version 5.1, the error is generated only on the third OPEN statement. The program must be on the root of the C drive to demonstrate the error.

Sample Code


         PROGRAM OpenError

      OPEN (1, FILE = 'C:Test.DAT')
      WRITE (*,*) 'C:Test.DAT Opened'  ! First path.

      OPEN (2, FILE = 'Test.DAT')      ! Second path, same file:
                                       ! should generate error.
      WRITE (*,*) 'Test.DAT Opened'

      OPEN (3, FILE = 'C:Test.DAT')    ! Error finally generated.
      WRITE (*,*) 'C:Test.DAT Opened Again'

      END 

Additional query words: 4.00 4.10 5.00 buglist4.00 buglist4.01 buglist4.10 buglist5.00 fixlist5.10

Keywords :
Version : :4.0,4.01,4.1,5.0
Platform :
Issue type :


Last Reviewed: November 4, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.