Unclassifiable Statement error in fortran 90

  • Context: Fortran 
  • Thread starter Thread starter Sandbox.WeC
  • Start date Start date
  • Tags Tags
    Error Fortran
Click For Summary

Discussion Overview

The discussion revolves around a Fortran 90 programming issue related to "Unclassifiable statement" errors encountered while attempting to read data from a file and perform calculations. The scope includes technical explanations and debugging assistance for a programming assignment.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant identifies that the use of square brackets [ ] in the expressions for z, u, and v should be replaced with parentheses ( ).
  • Another participant points out that the notation 1exp24 should be corrected to 1e24, unless it is a specific enhancement in Fortran 90 that is not widely known.
  • One participant questions whether the first two READ statements are causing issues, suggesting that they require variables to store the read values.
  • A different participant believes the first two READ statements are acceptable, assuming they are intended to skip the first two lines of the file.

Areas of Agreement / Disagreement

There is no clear consensus on whether the first two READ statements are problematic, as participants express differing views on their correctness and functionality.

Contextual Notes

There are unresolved assumptions regarding the input file format and the specific requirements of the assignment, which may affect the interpretation of the READ statements.

Sandbox.WeC
Messages
5
Reaction score
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
The [ ] should be ( ).

Also 1exp24 should be 1e24, unless 1exp24 is a F90 "enhancement" over F77 that I don't know about.
 
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.
 
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.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 4 ·
Replies
4
Views
28K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 8 ·
Replies
8
Views
2K