FIX: No Check for OPENing Same File with Different PATH (84624)



The information in this article applies to:

  • Microsoft FORTRAN Compiler for MS-DOS 4.0
  • Microsoft FORTRAN Compiler for MS-DOS 4.01
  • Microsoft FORTRAN Compiler for MS-DOS 4.1
  • Microsoft FORTRAN Compiler for MS-DOS 5.0
  • Microsoft FORTRAN compiler for OS/2 4.0
  • Microsoft FORTRAN compiler for OS/2 4.01
  • Microsoft FORTRAN compiler for OS/2 4.1
  • Microsoft FORTRAN compiler for OS/2 5.0

This article was previously published under Q84624

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
				

Modification Type:MajorLast Reviewed:12/1/2003
Keywords:kbfix KB84624