FIX: Incorrect Results Using a COMPLEX Array in a NAMELISTLast reviewed: September 11, 1997Article ID: Q71186 |
5.00 | 5.00
MS-DOS | OS/2
kbtool kbfixlist kbbuglist
The information in this article applies to:
SYMPTOMSAn application that uses a NAMELIST-directed READ statement to initialize an array of COMPLEX values generates incorrect results.
CAUSEThis error occurs when the data in the input file has one element per line.
RESOLUTIONTo work around this problem, modify the data in the input file to place the data for all array elements on one line.
STATUSMicrosoft has confirmed this to be a problem in FORTRAN version 5.0 for MS-DOS and OS/2. This problem was corrected in FORTRAN version 5.1 for MS-DOS and OS/2.
MORE INFORMATIONThe following code example reads the NAMELIST data file TEST.DAT.
Sample CodeC Compile options needed: None
COMPLEX MYDATA(5) NAMELIST /XX/ MYDATA OPEN (1, FILE = 'TEST.DAT') READ (1, XX) WRITE (*, *) MYDATA END NAMELIST Input File #1&xx mydata(1) = (1.0, 2.0) mydata(2) = (3.0, 4.0) mydata(3) = (5.0, 6.0) mydata(4) = (7.0, 8.0) mydata(5) = (9.0, 10.0) / Using NAMELIST Input File #1, the code example produces the following output.
(1.000000,3.000000) (5.000000,7.000000) (9.000000,10.000000) (0.000000E+00,0.000000E+00) (0.000000E+00,0.000000E+00)The output should be as follows.
(1.000000,2.000000) (3.000000,4.000000) (5.000000,6.000000) (7.000000,8.000000) (9.000000,10.000000)To work around this problem, rearrange the data in the input file to place all the elements on one line. The following input file demonstrates this solution.
NAMELIST Input File #2&xx mydata = (1.0, 2.0) (3.0, 4.0) (5.0, 6.0) (7.0, 8.0) (9.0, 10.0) / Note: A data file can contain repeat factors if the data contains more than one element with the same value. The following input file demonstrates this technique.
NAMELIST Input File #3&xx mydata = 2*(1.0, 2.0) (3.0, 4.0) (5.0, 6.0) /
|
Additional reference words: 5.00 buglist5.00 fixlist5.10
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |