On Mon, 13 Nov 2023 at 19:37, Paul Schuster <[email protected]> wrote:
> How to handle this situation: task ‘A’ attaches a subtask, task ‘B’. > > The ‘B’ task issues a STIMERM WAIT=YES > > Task ‘A’ terminates, but gets the A03 abend since task ‘B’ still active. > > How can task ‘A’ communicate to the subtask ‘B’ that it (task ‘B’) needs > to terminate? Task ‘B’ is in the STIMERM wait, so it can’t do anything. > The typical approach is to not use WAIT on the STIMERM in Task B, but rather specify a local ECB to be POSTed. Then do your own WAIT, specifying both that ECB and also an ECB that Task A passes to Task B as an argument on the ATTACH[X]. When Task A wants to shut things down, it POSTs the ECB it passed to B, and then in turn *it* WAITs on the other ECB that you specified on the ATTACH with ECB=. When Task B awakes from its WAIT, it checks which ECB was posted. If it's the STIMER one, it does whatever it does for that, and goes back and re-issues the STIMERM and the WAIT. If it's the one saying "A says to shut down", B cleans up and returns to the system, which then POSTs the ECB that A put on the ATTACH. This assumes that in your description Task A *intends* to shut down B and then itself. If Task A instead terminates unexpectedly, then you need to figure out what you *want* it to do. You could put ESTAI= on the ATTACH, and catch B's abend there. But if A abended in the first place... This isn't really as complex as I'm making it sound with a poorly organized description. Just don't do that WAIT on the STIMERM. Tony H. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
