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:
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.
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.
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 : kbFortranPS kbLangFortran kbfixlist
Version : 3.30 4.00 4.01 4.10 5.00 5.10 1.
Platform : MS-DOS NT OS/2 WINDOWS
Solution Type : kbfix
Last Reviewed: September 14, 1997