Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pls, help me with this problem... (original posted in dBase section)

Status
Not open for further replies.

Rosciano

Technical User
Jun 16, 2003
64
IT
Hi everybody,

(dBase III Plus)
How would you guys check "if equal" a memory variable containing a word, created by a first pass of program, against ITSELF during the second (and the third, fourth, fifth,… infinite times) steps of program?
I tried to store the word to a (temp.var.) during the first pass, but happens that during the second, and subsequent steps, the (temp.var.) created is actualized (stores) with the new word!
Due to infinity times by this step, a counter, or different temp.var. would be impractical…

Any hint? [bigears] Thanks!
(sorry for my English…) [sad]
 
Without a sample of your code's structure in those areas, my guess is that your temp variable is declared in a subroutine, then when it returns to a higher level the variable is discarded (as out of scope) and when you go back into that subroutine it's gone.

Can you declare the variable at a higher level of code so it doesn't go out of scope? Alternatively, you could declare the variable as PUBLIC ( PUBLIC TempVar ) so it would exist permanently until the program ends. Typically, declaring a temp variable as PUBLIC isn't considered good code, better to initialize it at a higher level, if possible.

If you need the variable to exist from one program or computer session to the next then you'd have to either write it into code or write it to a file to be read in the next time.
 
Thanks Mark,

Well, it happens a week ago and now I don’t remember exactly what the problem was. I do remember that I quit, waiting a help, and took another problem (this program has a LOT of problems...)
I do remember that the temp.var. was not in a subroutine and the level remained unchanged. I’m aware of levels, public var., privates and so on, but as I said, I don’t remember right now the problem. After that, I took more of less a dozen other issues, some was solved others not.
I’m working right now with the program, and when I change one thing, destroys another…

You will for sure listening of me, when I faced that problem again…

Thanks again Mark [wink]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top