0

I am using someone's Fortran scripts, I have changed a little bit in that. Now I am having a syntax error while executing it. I am new to Fortran so not able to figure it out.

The code is as follows:

integer  i_canorg
integer  i
integer  n
integer  canorg(n)
real  r1demdoms(n)
real  r1supdoms(n)
real  r1supdomcan(n)
real  r1rivout(n)
real  r1envflw(n)

if(canorg(i).ne.0)then
  i0l_canorg=canorg(i)
  call calc_supcan1(i_canorg,r1demdoms(i),r1supdoms(i),r1rivout(i_canorg),r1envflw(i_canorg),r1supdomcan(i))    
end if

The code is very long, I additionally added the if command and i_canorg parameter.

I am getting the following error while running the code:


  348 |      call calc_supcan1(i0lcanorg,r1demdoms(i),r1supdoms(i),r1rivout(i_canorg),r1envflw(i_canorg),r1supdomcan(i))
      |                                                                        1
Error: Syntax error in argument list at (1)

What can be the reason behind this syntax error?

0

1 Answer 1

5

The reason the program is not compiling is that the line is too long, and unfortunately your compiler's error is not helpful for figuring that out. The dead giveaway is that, including the six spaces at the beginning of the line in the error message, the 1 in the error message is at column 73. Your compiler is interpreting the source code in fixed source form, which has some very particular requirements: see section 3.3.2 of N1191 for complete details.

Your compiler should have an option to specify that your source code should be interpreted in free source form. Based on your error message, it looks like you are most likely using gfortran, which has the command-line option -ffree-line-length-[n]. Check the documentation and set it to an appropriate value for your source code.

If you wish to continue to use fixed source form, then the line has to be broken into multiple lines with a continuation character in the sixth column of each continued line. The character can be anything except a space ( ) or a zero (0), and is ignored if it is in a comment line (a line beginning with the letter C or an asterisk (*)). This is one possible way of fixing the line:

****** <- note the six special columns at the beginning of the line
      call calc_supcan1(i_canorg,r1demdoms(i),r1supdoms(i),
     > r1rivout(i_canorg),r1envflw(i_canorg),r1supdomcan(i))
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.