>hello, there is a way to write a recursive procedure in FoxPro 2.6 ?
>actually there is the limit of 32 nested DO, but i need a limit of 200.
>Someone could help me ?
You'd write a recursive procedure in 2.6 the same way you would in any other language. Here's an example that locates the next available element in an array used for a list. In this, some elements may be disabled by the backslash character.
FUNCTION Next_Avail
PARAMETERS p_start, pa_array, p_finish
EXTERNAL ARRAY pa_array
PRIVATE m.result, m.startover, m.i, m.last, m.fnd
IF PARAMETERS() = 3
m.last = p_finish
ELSE
m.last = ALEN(pa_array, 1)
ENDIF
m.startover = NOT EMPTY(p_start)
m.i = p_start
m.fnd = .F.
m.result = 0
DO WHILE m.i < m.last AND NOT m.fnd
m.i = m.i + 1
m.fnd = (LEFT(pa_array(m.i), 1) <> "\")
ENDDO
IF m.fnd
m.result = m.i
ELSE
IF m.startover
m.result = Next_Avail(0, @pa_array, p_start - 1)
ENDIF
ENDIF
RETURN m.result
Of course, you must be sure that the routine will terminate properly. As far as the level of nested DOs is concerned, don't forget that whenever a routine returns to the caller, the count is decreased by one.
George
George
Ubi caritas et amor, deus ibi est