Need help for error in Fortran90

In summary: I'm trying to use the command "for /f " %f in (c:\temp\%GOTOPATH%\%file%) do (...) but it doesn't work.In summary, Theo McCloskey told me to avoid using the command ASSIGN and GOTO, and to rewrite the program.
  • #1
VSan
4
0
Hi everyone,

I'm a student and I'm new in this language but I have to run a fortran90 code for my advisor. However, there is some error as provide below (I got the completed code to run for the results, which means that it doesn't suppose to have any error - but it's quite old. I run it on Mac using gfortran and Xcode)

--------------------------------------------------------------------------
FF.f90:8263.23:

10 ASSIGN 30 TO NEXT
1
Warning: Obsolete: ASSIGN statement at (1)
FF.f90:8272.19:

GO TO NEXT,(30, 50, 70, 90, 110)
1
Warning: Obsolete: Assigned GOTO statement at (1)
FF.f90:8274.23:

ASSIGN 50 TO NEXT
1
Warning: Obsolete: ASSIGN statement at (1)
FF.f90:8284.23:

ASSIGN 70 TO NEXT
1
Warning: Obsolete: ASSIGN statement at (1)
FF.f90:8289.24:

100 ASSIGN 110 TO NEXT
1
Warning: Obsolete: ASSIGN statement at (1)
FF.f90:8315.23:

85 ASSIGN 90 TO NEXT
1
Warning: Obsolete: ASSIGN statement at (1)
FF.f90:8334.35:

GO TO NEXT,( 50, 70, 90, 110 )
1
Error: Syntax error in GOTO statement at (1)


-----------------------------------------------------------

Thank you very very much for your help. I don't have any knowledge in this language so I cannot figure it out what's wrong.

Regards,
 
Technology news on Phys.org
  • #2
We could probably be more helpful if you linked or pasted your code. Just from seeing that you're using ASSIGN and GOTO statements, I'm going to suggest that you rewrite your program. ASSIGN and GOTO are horrible ways to program in FORTRAN.
 
  • #3
Thanks so much... I'll try to rewrite it again!
 
  • #4
Yeah, ASSIGN has been depreciated and should be avoided. This code technique is old and can be very confusing (sort of reminds me of original BLAS routine for DNRM2 before its re-write). Try to avoid the GOTOs as well if you can. But if you must, I believe the correct syntax for the computed GOTO is (for example):

Code:
GO TO (50, 70, 90, 110), NEXT
 
  • #5
Thank you very much

I know what's wrong with it now but I still didn't find the right way to run it :(

The command ASSIGN GO TO was deleted in Fortran95 and I don't know why gfortran cannot run it, since it said it can run for g90 as well.

Again thank you
 
  • #6
There are switches you can specify to force compilier to use fortran90 or earlier (see doc's). On Windows version, you can also just rename file extension to (lower case) .f or .f90 to achieve this result automatically. In any event, be careful if you're using free-format code, as some earlier versions do not support this format.
 
  • #7
Hi TheoMcCloskey,

Thank you for your advice!
Actually I'm also using Inter Fortran in Windows... But I'm confused for the Visual Studio and when I executed my code, it succeed but I cannot find the result files!
 

What is Fortran90?

Fortran90 is a programming language commonly used in scientific and engineering fields. It is an updated version of the original Fortran language and is designed for efficient numerical and scientific computing.

What is the most common error in Fortran90?

The most common error in Fortran90 is a syntax error, which is caused by incorrect use of the language's rules and structure. This can include missing or misplaced punctuation, incorrect variable declarations, or using the wrong data type.

How do I fix a syntax error in Fortran90?

To fix a syntax error, carefully review your code and check for any missing or misplaced punctuation, incorrect variable names or declarations, and ensure that you are using the correct data types. You can also use a compiler or debugger to identify and fix syntax errors.

What is a runtime error in Fortran90?

A runtime error in Fortran90 is an error that occurs while the program is running. This can be caused by a variety of factors, such as attempting to divide by zero, accessing an array out of bounds, or trying to perform an operation on a variable with an invalid data type.

How can I prevent runtime errors in Fortran90?

To prevent runtime errors in Fortran90, it is important to thoroughly test and debug your code before running it. Carefully check for any potential issues, such as dividing by zero or accessing arrays out of bounds. It is also helpful to use a debugger or compiler to catch and fix any potential errors before running the program.

Similar threads

  • Programming and Computer Science
Replies
16
Views
1K
  • Programming and Computer Science
2
Replies
57
Views
3K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
11
Views
2K
  • Programming and Computer Science
Replies
11
Views
2K
  • Programming and Computer Science
Replies
2
Views
2K
  • Programming and Computer Science
Replies
32
Views
2K
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
18
Views
4K
  • Programming and Computer Science
Replies
8
Views
32K
Back
Top