
[Sponsors] 
January 26, 2006, 21:27 
fortran error for g77 compiler

#1 
Guest
Posts: n/a

This queston is related to fortran coding I am running a fortran coode in Linux using g77 I get the following error when I compile the error. This error is related to the symbol (ampers and) & which I use as continuation of statement on next line. the error is read(11,*) (((x(i,j,k,n),i=1,ii(n)),j=1,jj(n)),k=1,kk(n)),^
& (((y(i,j,k,n),i=1,ii(n)),j=1,jj(n)),k=1,kk(n)), ^ Expression at (^) has incorrect data type or rank for its context (This is the error for first line) Statement at (^) begins with invalid token [info f g77 M LEX] (This the error for second line) Can somebody tell me how to remove it Thank you 

January 26, 2006, 21:42 
Re: fortran error for g77 compiler

#2 
Guest
Posts: n/a

Make sure the ampersand is in column 6.


January 26, 2006, 21:44 
Re: fortran error for g77 compiler

#3 
Guest
Posts: n/a

I've got lost when trying to understand your read statement. This problem can be due your implicit loops in the read statement (unbalanced parentheses or arrays with wrong rank). Why don't you try to rewrite this sentence with explicit loops? It would be easier to understand where is your problem...
Cheers Renato 

January 26, 2006, 21:47 
Re: fortran error for g77 compiler

#4 
Guest
Posts: n/a

Yeah Ag,
it's the first think Vishwas must check ;) 

January 26, 2006, 22:20 
Re: fortran error for g77 compiler

#5 
Guest
Posts: n/a

This queston is related to fortran coding. I am running a fortran code in Linux using g77. I get the following error when I compile the error. This error is related to the symbol (ampers and) & which I use as continuation of statement on next line. The ampersand is in column 6.
read(11,*) (((x(i,j,k,n),i=1,ii(n)),j=1,jj(n)),k=1,kk(n)),^ &(((y(i,j,k,n),i=1,ii(n)),j=1,jj(n)),k=1,kk(n)) , ^ Expression at ^ has incorrect data type or rank for its context (This is the error for first line) Statement at (^) begins with invalid token [info f g77 M LEX] (This the error for second line) Can somebody tell me how to remove it. Thank you 

January 27, 2006, 05:47 
Re: fortran error for g77 compiler

#6 
Guest
Posts: n/a

Assuming the third line you have not shown is something like:
& n=1,4) you have missed a bracket at the beginning for the index n. 

January 27, 2006, 12:11 
Re: fortran error for g77 compiler

#7 
Guest
Posts: n/a

Consider using explit loops: do i = 1, ii(n) do j = 1, jj(n) do k = 1, kk(n)
read (11,*) x(i,j,k,n), y(i,j, k,n) end do end do endo 

January 27, 2006, 12:29 
Re: fortran error for g77 compiler

#8 
Guest
Posts: n/a

I hope it's obvious that in what I suggested in previous mail, there are seven (7) lines.


January 29, 2006, 20:35 
Re: fortran error for g77 compiler

#9 
Guest
Posts: n/a

Malik's suggestion will lead to slightly different behaviour from the original code (which will read the data from a single line rather than from ii(n)*jj(n)*kk(n) separate lines). This could be fixed by using a format statement in the read.


January 29, 2006, 20:44 
Re: fortran error for g77 compiler

#10 
Guest
Posts: n/a

As mentioned previously for FORTRAN 77 the code should read something like this:
123456 READ(11,*) 12345& (((x(i,j,k,n),i=1,ii(n)),j=1,jj(n)),k=1,kk(n)), 12345& (((y(i,j,k,n),i=1,ii(n)),j=1,jj(n)),k=1,kk(n)), 12345& (((z(i,j,k,n),i=1,ii(n)),j=1,jj(n)),k=1,kk(n)) where 12345 should be replaced with spaces. You may also like to use a different character. If the compiler is actually expecting f90 or f95 you may like to try: READ(11,*) & (((x(i,j,k,n),i=1,ii(n)),j=1,jj(n)),k=1,kk(n)), & (((y(i,j,k,n),i=1,ii(n)),j=1,jj(n)),k=1,kk(n)), & (((z(i,j,k,n),i=1,ii(n)),j=1,jj(n)),k=1,kk(n)) If neither of these work perhaps you could post some more details of the code (which looks like a pretty standard PLOT3D reader). 

January 30, 2006, 17:16 
Re: fortran error for g77 compiler

#11 
Guest
Posts: n/a

this works with my compiler:
read(11,*)((((x(i,j,k,n),i=1,ii(n)),j=1,jj(n)),k=1 ,kk(n)), & (((y(i,j,k,n),i=1,ii(n)),j=1,jj(n)),k=1,kk(n)),n=1 ,4) & is in column 6 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Intel Fortran Compiler & Tutorial 17  Young  CFX  1  March 30, 2011 01:39 
Fortran Compiler and example  Young  CFX  1  March 22, 2011 23:26 
OF 1.6  Ubuntu 9.10 (64bit)  GLIBCXX_3.4.11 not found  piprus  OpenFOAM Installation  22  February 25, 2010 13:43 
Fortran compiler  Erik  CDadapco  2  November 28, 2008 20:05 
Fortran compiler  Arnab  CDadapco  5  September 14, 2004 03:59 