I apologize for that lapsus. Of course we must consider and distinguish global variables and values passed as parameters to a function call. In KIX the latter are passed by value, hence as copies, and are destroyed on exit from the function.
I am working on a function calling another function, as calling a subroutine with GOSUB seems not to work from inside a function. The KIX manual states that GOSUB "label" can use also an expression. So my first approach was to pass the "label" as parameter to a function, like this:
Code:
doScheduledTask($startY, $startM, $startD, $nameOfSubOrFunction) ;call function
;Function declaration
FUNCTION doScheduledTask($startY, $startM, $startD, $nameOfSubOrFunction)
;depending on parameters $startY, $startM, $startD, etc. call sub or function
GOSUB $nameOfSubOrFunction ;this is syntactically correct, but subs can not be called here
$rc = $nameOfSubOrFunction ;so I modified all the code to use a function instead
ENDFUNCTION
;Function declaration
FUNCTION testTask()
? "we are in testTask() now"
ENDFUNCTION
In the latter form the desired function IS NOT CALLED, if I pass
Code:
doScheduledTask(2006,02,28, "testTask()")
Maybe it is not possible to call a function by the "label" being an expression like GOSUB $end, as illustrated in the KIX manual?
Thanks for your help, Rosario