PRB: Opening Scratch File with Units 0, 5, or 6 Causes F6202 (87982)



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 MS-DOS 5.1
  • Microsoft FORTRAN compiler for OS/2 4.1
  • Microsoft FORTRAN compiler for OS/2 5.0
  • Microsoft FORTRAN compiler for OS/2 5.1
  • Microsoft FORTRAN PowerStation for MS-DOS 1.0
  • Microsoft FORTRAN PowerStation for MS-DOS 1.0a
  • Microsoft Fortran Powerstation 32 for Windows NT 1.0
  • Microsoft Fortran Powerstation 32 for Windows NT 4.0

This article was previously published under Q87982

SYMPTOMS

Programs that open an unformatted scratch file with the unit number 0, 5, or 6 may cause the following error:
run-time error F6202: OPEN(CON)
-terminal I/O not consistent with OPEN options

CAUSE

The unit numbers 0, 5, and 6 for the open statement have been pre-assigned to do formatted I/0 on keyboard and screen. Opening unformatted scratch files with these unit numbers causes the runtime to attempt to open the keyboard or screen for unformatted I/O, which generates the above error. This is expected and correct behavior.

RESOLUTION

To avoid this error, open the scratch file with any number other than 0, 5, and 6.

MORE INFORMATION

Sample Code #1

The following code generates the error:
      open(6, form='unformatted')
      end
				

Sample Code #2

The following code illustrates a correct usage of the open statement for creating an unformatted scratch file:
      open(3, form='unformatted')
      end
				

Modification Type:MajorLast Reviewed:12/1/2003
Keywords:kberrmsg kbLangFortran KB87982