Problem:
When CBL_DEBUGBREAK is included in code containing threads running at the same time, the first thread that hits it causes Animator to start, but the other threads execute through with no animation.
Resolution:
CBL_DEBUGBREAK tries to start a copy of the debugger, but as only one debugger is allowed per process (Microsoft limitation), the call to CBL_DEBUGBREAK made by the second, third and fourth thread, etc.. fails. Displaying the return-code straight after the CBL_DEBUGBREAK call, and seeing that is 0 the first time but it isn't on subsequent calls.
A solution would be to lock the call to CBL_DEBUGBREAK, so the first thread that gets there it, and all the others wait until the first one unlocks it. That would give you the chance to start Animator and once Animator is up to swap from one thread to the other using "Animate / Threads...". You can Freeze threads, Thaw them, set one as active, and so on...
There are several ways to do this. One way is to call CBL_DEBUGBREAK within another program, lets say stophere.cbl that is compiled with the SERIAL directive. Then call stophere.cbl instead of CBL_DEBUGBREAK.
stophere.cbl
$SET SERIAL
PROCEDURE DIVISION.
CALL "CBL_DEBUGBREAK"
EXIT PROGRAM.
myprogram.cbl
...
CALL "stophere"
Another way would be using mutex:
...
call "CBL_THREAD_PROG_LOCK"
call "CBL_DEBUGBREAK".
call "CBL_THREAD_PROG_UNLOCK"
Finally, a less elegant alternative would be to make all threads loop until to take control of the thread using animator and manually make a certain condition to be true to cause the thread to get out of the loop. Once having done that, to make sure that freezing the thread, otherwise when setting a different thread as active, this one will run freely until the end... Breakpoints only work with the thread that is currently active.
....
01 stophere pic 9 value 0.
....
call "CBL_DEBUGBREAK".
perform until stophere = 9
call "CBL_THREAD_YIELD"
end-perform
...