Microsoft KB Archive/74461

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

Article ID: 74461

Article Last Modified on 12/1/2003

-

APPLIES TO


 * Microsoft FORTRAN Compiler 3.3
 * Microsoft FORTRAN Compiler 4.0
 * Microsoft FORTRAN Compiler 4.01
 * Microsoft FORTRAN Compiler 4.1
 * Microsoft FORTRAN Compiler 5.0
 * Microsoft FORTRAN Compiler 5.1
 * Microsoft FORTRAN Compiler 4.1
 * Microsoft FORTRAN Compiler 5.0
 * Microsoft FORTRAN Compiler 5.1
 * Microsoft FORTRAN PowerStation 1.0 Standard Edition
 * Microsoft Fortran PowerStation 1.0a for MS-DOS
 * Microsoft FORTRAN PowerStation 32

-



This article was previously published under Q74461



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:

&quot;...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.&quot;

The ANSI 77 Standard also states:

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

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 &quot;F6501: end of file encountered&quot; should be generated after the variable x2 is read.

Additional query words: 1.00 5.00 5.10

Keywords: kbfix kblangfortran KB74461

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.