Unclassifiable Statement error in fortran 90

In summary, the conversation discusses a programming assignment that has encountered a roadblock due to the lack of experience with Fortran. The code provided is a simple program that opens two files and uses a loop to read values and perform calculations on them. However, the program is facing issues with the z=, u=, and v= statements, which are giving unclassifiable statement errors. The conversation also addresses potential problems with the read and write statements, and suggests using the correct format for exponential notation. The conversation ends with a request for more information, such as the line number of the unclassifiable statements.
  • #1
Sandbox.WeC
5
0
I'm writing this program for an assignment and I have run into a roadblock. I thought it was a pretty simple program, but I think my lack of experience with fortran is working against me.. Here is the bare code:

Program Readfile
implicit none
real(kind=8)::x,y,z,u,v
integer::n

OPEN(unit=12,file="file1.data")
OPEN(unit=13,file="file2.data")

read(12,*)
read(12,*)

DO n=1,38,1
read(12,*)x,y
z = LOG10[x]
u = LOG10[y]
v = LOG10[(x*x*x*y)/(1exp24)]
write(13,*)x,y,z,u,v
END DO

close(12)
close(13)
END PROGRAM

It is a simple concept. All it has to do is open file1 to get 2 values, then write in file2 those values, and a couple functions of them. The read(12,*) lines are used to skip the first two lines in file one, because they are junk. I am doing n=1,38 because there are 38 lines the program must do this to. The problem arises with the z= , u= , and v= statements. When I compile using the command gfortran file.f90 -o file.o it comes back and gives me Unclassifiable statement errors for all 3. What is my problem? Sorry if it is really obvious..
 
Technology news on Phys.org
  • #2
The [ ] should be ( ).

Also 1exp24 should be 1e24, unless 1exp24 is a F90 "enhancement" over F77 that I don't know about.
 
  • #3
In addition to what AlephZero said, your first two READ statements are probably causing problems. These statements require one or more variables for the value(s) read to be stored in. I haven't written any fortran code for about 15 years, but I think this is correct.

Does your compiler give the line number of the unclassifiable statement? That would be helpful information.
 
  • #4
Mark44 said:
In addition to what AlephZero said, your first two READ
statements are probably causing problems. These statements require one or more variables for the value(s) read to be stored in.

I think those are OK. They will read and ignore the first two lines of the file, assuming that's what the OP wants to do.
 
  • #5


It seems like the issue may be with the syntax of your LOG10 function calls. In Fortran 90, the syntax for the LOG10 function is LOG10(x) where x is the value you want to take the logarithm of. So in your code, it should be z = LOG10(x), u = LOG10(y), and v = LOG10((x*x*x*y)/(1exp24)). Also, make sure you have defined the variables x, y, z, u, and v as real numbers before using them in the LOG10 function. Another possibility is that you may be missing a multiplication symbol between 1 and exp24 in your v statement. It should be 1*exp24. I hope this helps and good luck with your program!
 

1. What is an "Unclassifiable Statement" error in Fortran 90?

An "Unclassifiable Statement" error in Fortran 90 occurs when the compiler is unable to determine the type or purpose of a statement in the code. This can happen if the statement is written incorrectly or if there is a missing or extraneous symbol or keyword.

2. How can I fix an "Unclassifiable Statement" error in my Fortran 90 code?

The first step in fixing an "Unclassifiable Statement" error is to carefully review the statement in question and make sure it is written correctly. Check for missing or incorrect keywords, symbols, or syntax. If everything appears to be correct, try rearranging the statement or breaking it up into multiple statements to see if that resolves the error.

3. Can an "Unclassifiable Statement" error be caused by a missing or incorrect data type declaration?

Yes, an "Unclassifiable Statement" error can be caused by a missing or incorrect data type declaration. Fortran 90 requires all variables to be declared with a specific data type, and if this declaration is missing or incorrect, the compiler may not be able to determine the purpose of a statement using that variable.

4. Is it common to encounter "Unclassifiable Statement" errors while coding in Fortran 90?

While it is not uncommon to encounter "Unclassifiable Statement" errors while coding in Fortran 90, it is not a common occurrence. These errors typically arise from mistakes in the code, such as typos or incorrect syntax, and can usually be resolved by carefully reviewing and correcting the code.

5. Are there any resources available to help troubleshoot "Unclassifiable Statement" errors in Fortran 90?

Yes, there are many resources available to help troubleshoot "Unclassifiable Statement" errors in Fortran 90. These include online forums and communities where fellow programmers can offer assistance, as well as official documentation and tutorials from the Fortran language developers. It can also be helpful to use a debugger or code analysis tool to pinpoint the source of the error.

Similar threads

  • Programming and Computer Science
Replies
4
Views
602
  • Programming and Computer Science
Replies
4
Views
1K
  • Programming and Computer Science
Replies
12
Views
959
  • Programming and Computer Science
Replies
8
Views
1K
  • Programming and Computer Science
Replies
5
Views
4K
  • Programming and Computer Science
Replies
2
Views
2K
  • Programming and Computer Science
Replies
8
Views
1K
  • Programming and Computer Science
Replies
12
Views
2K
  • Programming and Computer Science
Replies
8
Views
3K
  • Programming and Computer Science
Replies
3
Views
1K
Back
Top