Unfortunatley there is no facility to pass a variable by reference to a DB function. C/C++ does this and even VB.
If you could do this then better code structure would be possible. The return value of the function would merely state if the function had succeeded or not.
If you want your functions to be able to change values of variables then they have to be global. Therfore you must create an array (even if you just want a scalar value), a user defined type (even if it just has one integer element).
eg
Dim XPOS(1) : Dim YPOS(1) : Dim ZPOS(1)
XPOS(0) = 0 : YPOS(0) = 1 : ZPOS(0) = 2
Dim MyObject#(3)
SetupObject()
print MyObject#(XPOS(0))
print MyObject#(YPOS(0))
print MyObject#(ZPOS(0))
end
function SetupObject()
MyObject#(XPOS(0)) = 15.789
MyObject#(YPOS(0)) = 45.897
MyObject#(ZPOS(0)) = 66.789
Retval = 1
EndFunction RetVal
The new Types in DBPro take care of this unweidly method for you but essentially is the same thing, you still cannot pass your object to the function thus;
OK = SetupObject(MyObject)
If Not OK then ErrorCode("SetupObject failed")
The alternative is to use Gosub, which may not be the best method for you.