Multiple statements on same line in FORTRAN 90

11,401

Solution 1

Your line of code is 134 characters long and, even with Fortran 90-style free format code, most compilers impose a maximum line length. For example, with Sun Studio the default limit is 132 characters.

You can usually increase this character limit using compiler flags, but I suggest splitting that code so that you have one statement per line. It is more legible to human readers and compile- and run-time error messages may be more easily diagnosed.

Solution 2

Adding to the comments of @Deditos, in this case you could use Fortran array notation to reduce the number of lines since all of the elements are being set to the same value:

lb (1, 1:9) = 1.0

Are all elements of the array being initialized to 1.0? Then simply:

lb = 1.0
Share:
11,401
disruptive
Author by

disruptive

Updated on June 17, 2022

Comments

  • disruptive
    disruptive almost 2 years

    I have a whole series of assignments which I have put on the same ike using a ";" to seperate the statemnts but I get this error:

    1.0; lb(1,9) 1 Error: Unclassifiable statement at (1) In file LJ.F90:223

    I do not understand where there is coming from, when I have the code working if each statement is on its own line. The code is really simple...

    What am I stupidly doing wrong.. below code is all on one line.

    lb(1,1) = 1.0; lb(1,2) = 1.0; lb(1,3) = 1.0; lb(1,4) = 1.0; lb(1,5) = 1.0; lb(1,6) = 1.0; lb(1,7) = 1.0; lb(1,8) = 1.0; lb(1,9) = 1.0