I am currently learning Cobol language, and I wrote a paragraph with the following structure :
MYPARA.
EVALUATE TRUE
WHEN COND1
...
WHEN COND2
...
PERFORM MYPARA
WHEN OTHER
...
END-EVALUATE
.
This is a recursion that works great, however I just learned that it must not be done because it can lead to unpredictable results ( In COBOL, is it possible to recursively call a paragraph? ). So is it impossible to have recursion within the same Cobol program ?
I thought about using an intermediary paragraph : MYPARA execute MYPARA2 and MYPARA2 execute MYPARA. Is it exactly the same or different for the compiler/execution ?
The execution works great, but it is clearly stated that a paragraph can't call itself. Any form of recursion between paragraph is possible or forbidden ?
In my case I could wrap the EVALUATE in a PERFORM UNTIL as an alternative to the recursion, but I really wanted to do it that way.