Nested loop problem in pgf90 compiler

Dear all
I am facing a problem while using pgf90 compiler…

when I am reading a file a matrix of 10x10 by the following command lines the compiler used to give the error while reading…


***** Command lines ********

open (unit=15, file=‘dem.asc’, status=‘old’)
read (15, *) ((G(i,j)%Id, j=1,10), i=1,10)
close(15)

***** Compiler error ***********

PGFIO-F-225/list-directed read/unit=15/lexical error-- unknown token type.
File name = /home/rkumar/HBV_v3/Neckar/input/morph/1000/dem.asc formatted, sequential access record = 7
In source file ReadData.f90, at line number 225

But when I am not using nested loop statements than it is working well
i.e,
open (unit=15, file=‘dem.asc’, status=‘old’)
do i=1,10
read (15, *) (G(i,j)%Id, j=1,10)
end do
close(15)

Please let me know if it a problem of nested loop or something else and also how can I use nested loop statement…

Hi gladiator,

How is the data laid out in ‘dem.asc’? Is it a file with 10 lines of 10 values each? Or a file with 100 values without any eol’s.

Thanks,
Mat

Hi Mk
Data in file is like a matrix form i.e
e.g 5 x5 matrix is like#

1 2 3 5 6
2 3 8 9 1
3 4 2 8 4
2 5 6 8 9
1 8 9 4 3

You might try this example and then tell us how your case differs:

program foo
type bb
integer Id
end type bb
integer g(10,10)
type(bb) :: r(10,10)

open(unit=15, file=‘dem.asc’, status=‘old’)
read (15,*) ((g(i,j),j=1,10),i=1,10)
close(15)
print *,g(1,1),g(10,10)

open(unit=15, file=‘dem.asc’, status=‘old’)
read (15,*) ((r(i,j)%Id,j=1,10),i=1,10)
close(15)
print *,r(1,1)%Id,r(10,10)%Id

end

cat dem.asc
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 11
0 1 2 3 4 5 6 7 8 22
0 1 2 3 4 5 6 7 8 33
0 1 2 3 4 5 6 7 8 44
0 1 2 3 4 5 6 7 8 55
0 1 2 3 4 5 6 7 8 66
0 1 2 3 4 5 6 7 8 77
0 1 2 3 4 5 6 7 8 88
0 1 2 3 4 5 6 7 8 99

pgf90 uf.f90
./a.out
0 99
0 99