FIX: Internal Read and MORE I/O List Items than in FORMAT

Last reviewed: September 11, 1997
Article ID: Q74461
3.30 4.00 4.01 4.10 5.00 5.10 1.00 1.00a | 4.10 5.00 5.10 | 1.00
MS-DOS                                   | OS/2           | WINDOWS NT
kbprg kbfixlist

The information in this article applies to:

  • Microsoft FORTRAN for MS-DOS, versions 3.3, 4.0, 4.01, 4.1, 5.0, and 5.1
  • Microsoft FORTRAN for OS/2, versions 4.1, 5.0, 5.1
  • Microsoft FORTRAN PowerStation versions 1.0 and 1.0a
  • Microsoft FORTRAN PowerStation 32 version 1.0

SYMPTOMS

In Microsoft FORTRAN versions 3.3, 4.0, 4.01, 4.1, 5.0, and 5.1, an internal file is not treated as a single record when a READ statement contains extra list items beyond the format specification's corresponding edit descriptors.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem was corrected in FORTRAN PowerStation, version 4.0.

MORE INFORMATION

The ANSI 77 Standard states that when there are more input or output list items than the number of specified FORMAT statement edit descriptors:

   "...the file is positioned at the beginning of the next record and
   format control then reverts to the beginning of the format
   specification terminated by the last preceding right parenthesis."

The ANSI 77 Standard also states:

   "...if an [internal] file is a character variable, character array
   element, or character substring, it consists of a single record."

The latter statement means that while reading from an internal file that is a character variable, character array element, or character substring, if more list items appear on a statement beyond the corresponding edit descriptors within the FORMAT, an end-of-file should be encountered.

However, Microsoft FORTRAN treats each character of a character variable as a single record, and will advance the file pointer to the next character in the variable instead of producing the F6501 end of file error message. The following code reproduces the problem:

       character*20 a
       a='123456789'
       read(a,'(f1.0,f2.0)')x1,x2,x3
       print*,x1,x2,x3
       end

The above code will produce the following results:

   1.000000   23.000000   4.000000

The run-time error "F6501: end of file encountered" should be generated after the variable x2 is read.


Additional reference words: 1.00 5.00 5.10
KBCategory: kbprg kbfixlist
KBSubcategory: FORTLngIss
Keywords : FORTLngIss kbfixlist kbprg
Version : 3.30 4.00 4.01 4.10 5.00 5.10 1.
Platform : MS-DOS NT OS/2 WINDOWS
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 11, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.