C$NCALLRUN
The C$NCALLRUN library routine returns the number of threads generated by a CALL RUN statement that are still running.
In thin client environment every client session has its own CALL RUN counter.
Syntax:
 CALL "C$NCALLRUN" GIVING threadCount
Parameters:
threadCount
PIC 9(n)
Receives the number of threads generated by a CALL RUN statement that are still running
Examples:
Example - Wait for all threads generated by CALL RUN to terminate before exiting
working-storage section.
77 cr-count pic 9(3).
...
procedure division.
...
  perform test after until cr-count = 0
    call "c$ncallrun" giving cr-count
    call "c$sleep" using 0.5
 end-perform
  goback.