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

Fortran programming question

  1. Sep 29, 2011 #1
    Hi all,


    This could be a basic question, and if it is, pardon me for my ignorance as I am a newbie to FORTRAN. I am trying to modify a FORTRAN code where I have added a subroutine (say SUB1) to calculate a variable, say (QX). What I did is to call this subroutine in another one (called SUB2) where all the input variables, except two, needed to calculate QX is specified / calculated. In order to get the aforementioned two variables, I called the subroutine (lets call it SUB3) dealing with them in the beginning of SUB2. When I am trying to print it out they are not passing the values I expect, but are passing very high values.

    What is it that I am doing wrong here? And please note that the two variables from SUB3 are not changed in the subroutine SUB2. I tried to use INTENT(IN) for these variables; and the code in return dumped an error "Error: Symbol at (1) is not a DUMMY variable".

    Any suggestion would be appreciated. Thank you for your time.
  2. jcsd
  3. Sep 29, 2011 #2


    User Avatar
    Science Advisor
    Homework Helper

    It would help if you attach some code that doesn't work. You can probably remove all the calcs to make it shorter and easier for other people to understand.

    Debugging code that you can see is sometimes hard. Debugging code that you can't see is even harder!
  4. Sep 29, 2011 #3


    User Avatar
    Science Advisor

    Hi krishvk, as AlephZero said, you really need to post some code if we are to figure this out.

    I think it's quite likely however that your problem is related to variable "scope". Are you perhaps assigning these values only to "local variables" in one of the subroutines?
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook