What you have shown below is recursion all right  but it's recursion in 3 GL. The issue is when u try to call events recursively in 4GL  Thats when the "recursion not implemented" message has real value. In your code you are pretty much implementing recursion yourself  only using the system stack. It would be intresting to see if the same works for calling "Event Labels" in a wrapper!
As many of you will already know, recursion is possible in Baan. Despite the 'Recursion not (yet) implemented' message that is sometimes shown when you actually try it. For example, the following works (meaning: I got something like this to work recently, the code below is untested as it stands):
function long fact(long n) { f_arg = n return(fact_aux()) } long f_arg long f_ret  This function guarantees that f_arg is not changed. function long fact_aux() { if f_arg = 0 then f_ret = 1 else DEC(f_arg) f_ret = fact_aux()  since f_arg is global, we must set it back INC(f_arg) endif return(f_ret) }
Actually, this can be done slightly simpler by declaring the 'f_ret' variable as a static local variable:
function long fact(long n) { f_arg = n return(fact_aux()) } long f_arg  This function guarantees that f_arg is not changed. function long fact_aux() { static long ret if f_arg = 0 then ret = 1 else DEC(f_arg) ret = fact_aux()  since f_arg is global, we must set it back INC(f_arg) endif return(ret) }
However, it can be made a lot simpler by doing it as follows:
 This function must be called with one long argument. function long fact(...) { static long n n = get.long.arg(1) return(n = 0 ? 1 : n * fact(n  1)) }
Or alternatively, using a macro:
 This function must be called with one long argument. function long fact(...) { #define n get.long.arg(1) return(n = 0 ? 1 : n * fact(n  1)) #undef n }
Summarizing: Recursion is possible if you  do not use explicit function arguments ('...' is allowed)
 do not use normal local variables ('static's are allowed)
Have fun! (Now ask yourself: is recursion really the best way to compute the factorial function?)
