Microsoft KB Archive/69509

LOGICAL Arrays in NAMELIST Cause F6501, F6507, and F6511 PSS ID Number: Q69509 Article last modified on 02-24-1994

5.00 | 5.00

OS/2

Summary:

Using Microsoft FORTRAN version 5.00, a program containing a NAMELIST group that has an array variable of type LOGICAL can generate the following errors:

run-time error: F6501 - end of file encountered

run-time error: F6507 - T or F expected in LOGICAL read

run-time error: F6511: READ(file name) - variable name not found

The errors are generated when the array of type LOGICAL is initialized using something other than a very restricted format.

Microsoft has confirmed this to be a problem in FORTRAN version 5.00. This problem was corrected in FORTRAN version 5.10. Problems still exist, however, when input for any array in a NAMELIST ends with a repeat factor. Query on NAMELIST and REPEAT FACTOR for more information.

More Information:

The program below produces the error

run-time error, F6501 - end of file encountered

when there is not at least one space following each comma in a LOGICAL array definition in a NAMELIST data file. The following program demonstrates this error:

logical foo(5) namelist /xx/ foo open (1,file='TEST.DAT',status='old') read(1,xx) write(*,*) foo end The file TEST.DAT appears as follows:

&xx foo = T,F,F,F,T /

If this input is taken from the keyboard rather than a file, the following error is generated:

run-time error: F6507 - T or F expected in LOGICAL read

This error is also produced when repeat factors are used in a LOGICAL array definition in a NAMELIST data file, as in the following example file:

&xx foo = T, 3*F, T /

Defining a LOGICAL array one element per line in a NAMELIST data file produces the error:

run-time error F6511: READ(file name) - variable name not found

The following data file produces the F6511 error:

&xx foo(1) = T foo(2) = F foo(3) = F foo(4) = F foo(5) = T /

Correct values are obtained using LOGICAL arrays in a NAMELIST data file by placing multiple array values on a single line with at least one space after each comma, as shown in the data file below:

&xx foo = T, F, F, F, T /

=
================================================================

Copyright Microsoft Corporation 1994.