Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Need help for error in Fortran90!

  1. Oct 25, 2011 #1
    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)


    10 ASSIGN 30 TO NEXT
    Warning: Obsolete: ASSIGN statement at (1)

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

    Warning: Obsolete: ASSIGN statement at (1)

    Warning: Obsolete: ASSIGN statement at (1)

    100 ASSIGN 110 TO NEXT
    Warning: Obsolete: ASSIGN statement at (1)

    85 ASSIGN 90 TO NEXT
    Warning: Obsolete: ASSIGN statement at (1)

    GO TO NEXT,( 50, 70, 90, 110 )
    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.

  2. jcsd
  3. Oct 25, 2011 #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.
  4. Oct 26, 2011 #3
    Thanks so much.... I'll try to rewrite it again!
  5. Oct 26, 2011 #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 (Text):
    GO TO (50, 70, 90, 110), NEXT
  6. Oct 26, 2011 #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
  7. Oct 26, 2011 #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.
  8. Oct 26, 2011 #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!
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook