birdie
3rd January 2012, 17:18
A happy new year to who ever this reads!
I need some help on usage of common variables.
I create a session with following code:
declaration:
string globe.ploc (3) BASED
string globe.plocs (1,1) BASED
common globe.ploc
common globe.plocs
before.program:
globe.ploc = "ZZZ"
alloc.mem(globe.plocs,3,10)
inlezen.plocs()
end()
functions:
function inlezen.plocs()
{
select bibbm042.*
where bibbm042._index1 = {:logname$}
as set with 1 rows
selectdo
globe.plocs(1,1) = bibbm042.ploc0
globe.plocs(1,2) = bibbm042.ploc1
endselect
}
Then in a second session I want to use the same variables again, so I add following code again:
declaration:
extern string gg(3)
string globe.ploc (3) based
string globe.plocs (1,1) based
common globe.ploc
common globe.plocs
before.program:
alloc.mem(globe.plocs)
gg=globe.plocs(1,1)
But now my problem: the globe.ploc works ok, but from the array I loose my values I did in prior piece of code. I assume due to the alloc.mem function. But if I don't use I get an error, EMPTY variables. What do i have to do in order to be able to use the values of globe.plocs from first piece of code?
I need some help on usage of common variables.
I create a session with following code:
declaration:
string globe.ploc (3) BASED
string globe.plocs (1,1) BASED
common globe.ploc
common globe.plocs
before.program:
globe.ploc = "ZZZ"
alloc.mem(globe.plocs,3,10)
inlezen.plocs()
end()
functions:
function inlezen.plocs()
{
select bibbm042.*
where bibbm042._index1 = {:logname$}
as set with 1 rows
selectdo
globe.plocs(1,1) = bibbm042.ploc0
globe.plocs(1,2) = bibbm042.ploc1
endselect
}
Then in a second session I want to use the same variables again, so I add following code again:
declaration:
extern string gg(3)
string globe.ploc (3) based
string globe.plocs (1,1) based
common globe.ploc
common globe.plocs
before.program:
alloc.mem(globe.plocs)
gg=globe.plocs(1,1)
But now my problem: the globe.ploc works ok, but from the array I loose my values I did in prior piece of code. I assume due to the alloc.mem function. But if I don't use I get an error, EMPTY variables. What do i have to do in order to be able to use the values of globe.plocs from first piece of code?