Need help for error in Fortran90

  • Context: Fortran 
  • Thread starter Thread starter VSan
  • Start date Start date
  • Tags Tags
    Error Fortran90
Click For Summary

Discussion Overview

The discussion revolves around troubleshooting errors in a Fortran90 code, specifically related to the use of obsolete programming constructs such as ASSIGN and GOTO statements. Participants explore potential solutions and alternatives for rewriting the code to comply with modern Fortran standards.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Homework-related

Main Points Raised

  • One participant reports errors related to obsolete ASSIGN and GOTO statements in their Fortran90 code.
  • Another participant suggests that ASSIGN and GOTO are poor programming practices and recommends rewriting the program.
  • A different participant acknowledges the obsolescence of ASSIGN and provides an example of correct syntax for computed GOTO.
  • One participant expresses confusion about why gfortran cannot run the code, despite it being compatible with Fortran90.
  • Another participant mentions compiler switches that can be used to force compatibility with earlier Fortran versions and notes potential issues with free-format code.
  • A later reply discusses using Intel Fortran on Windows and expresses confusion about locating result files after execution.

Areas of Agreement / Disagreement

Participants generally agree that ASSIGN and GOTO statements are outdated and problematic. However, there is no consensus on the best approach to resolve the issues presented, and multiple views on how to handle the code remain.

Contextual Notes

Participants mention the transition from Fortran90 to Fortran95 and the implications of using obsolete commands. There are also references to different compiler behaviors and file format considerations that may affect code execution.

Who May Find This Useful

This discussion may be useful for students or programmers working with legacy Fortran code, particularly those encountering similar issues with obsolete programming constructs and seeking modern alternatives.

VSan
Messages
4
Reaction score
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
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.
 
Thanks so much... I'll try to rewrite it again!
 
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
 
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
 
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.
 
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!
 

Similar threads

  • · Replies 16 ·
Replies
16
Views
3K
  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 19 ·
Replies
19
Views
3K
  • · Replies 11 ·
Replies
11
Views
12K
  • · Replies 11 ·
Replies
11
Views
3K
Replies
9
Views
2K