CALL "C$ASYNCPOLL" USING threadHandle                            threadStatus  | 
threadHandle   | Usage handle   | Must contain a valid thread handle.  | 
threadStatus   | PIC S9   | Represents the status of the thread. 0 	The thread still exists. 1 	The thread is terminated.  | 
working-storage section. 77 threadHandle usage handle. 77 threadStatus pic s9. ... procedure division. ...    call thread "programB" handle in threadHandle                           using "some data" ... exit-program.    call "c$asyncpoll" using threadHandle                              threadStatus    if threadStatus = 0 | The thread is still running       display message "Cannot exit, threads still running"    else       goback    end-if.  |