For Programmers: Free Programming Magazines  


Home > Archive > Fortran > May 2005 > wrong output from a variable (newbie question)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author wrong output from a variable (newbie question)
Darius

2005-05-24, 3:57 am

Hi there;
Using Compaq Visual Fortran
I am using a programme, which has a main file and few other subs.
files. There is a variable NSL which is calculated within Sub. NC.f90.
File Ory.f90 has access to this variable (NSL) too. Now when I add NSL
to output part of NC.f90, as to get it in output file, the output data
from NSL is quite ok. Now if I add NSL to output part of ORY.f90, then
results are wrong.

Whichever of above I use, the main programe produced wrong output data
for NSL, exactly like when I use NSL as output in ORY.f90.

Any help, comment and suggestions?
Thanks
Darius

Ian Bush

2005-05-24, 8:57 am


Hi Darius,

Darius wrote:

> Hi there;
> Using Compaq Visual Fortran
> I am using a programme, which has a main file and few other subs.
> files. There is a variable NSL which is calculated within Sub. NC.f90.
> File Ory.f90 has access to this variable (NSL) too. Now when I add NSL
> to output part of NC.f90, as to get it in output file, the output data
> from NSL is quite ok. Now if I add NSL to output part of ORY.f90, then
> results are wrong.
>
> Whichever of above I use, the main programe produced wrong output data
> for NSL, exactly like when I use NSL as output in ORY.f90.
>
> Any help, comment and suggestions?


Not really enough information to say too much here, but my guess would
be inconsistent declaration of NSL somewhere, e.g. by argument mismatch.

Would it be possible to post a cut down version to show what you are doing ?

Ian


Richard E Maine

2005-05-24, 3:59 pm

In article <1116911197.020746.122480@g47g2000cwa.googlegroups.com>,
"Darius" <dariush2003jp@yahoo.com> wrote:

> Ory.f90 has access to this variable (NSL) too.


This doesn't mean anything. I might be able to make some guesses as to
what you really mean, but that doesn't seem constructive. Your problems
sound a lot as though the code are having trouble with communicating the
variable. The above description of how it is communicated makes no
sense. I suspect that these matters are correlated - that is you
misunderstand something about the communication mechanisms.

It is no great crime to misunderstanding something. We can help with
that; makes us feel useful. But we need more data. How about some
Fortran code instead of just words?

Reasons that the above makes no sense, by the way:

1. Files don't access variables at all. Files aren't even relevant to
the Fortran language. Procedures are important, but files are not. The
difference matters; if you are about it, that could be part of
the problem.

2. There are numerous ways that one procedure can "access" variables
from another. You present no clue which of those numerous ways you are
referring to. The different ways have different possible errors. There
are COMMON, modules, argument lists, and host association, for a start.
Or maybe you are talking about something that wouldn't actually achieve
such access at all (such as including a file with the same declarations).

--
Richard Maine | Good judgment comes from experience;
email: my first.last at org.domain | experience comes from bad judgment.
org: nasa, domain: gov | -- Mark Twain
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com