On 2019-08-04 4:06 AM, Kirk Wolf wrote:
I'm curious.
Say that I have something like:

ATTACH EP=MYPROG,ECB=MYECB
LTR R15,R15
BZ ATTERR
ST R1,MYTCB
WAIT 1,ECB=MYECB
DETACH MYTCB

I know that I can get either the subtask return code or ABEND completion
code(s) from the ECB.  But in the case of an ABEND, is there an easy way to
get the reason code?
Or do I need an ESTAI routine on the ATTACH to capture that?
Similarly, what about the normal completion reason code (R0)?

Should that be
BNZ ATTERR
?

By the time control returns after the ATTACH, you don't really know if the subtask has started, is running, or has completed unless you have organised some inter-task protocol.

After the WAIT on the ECB has popped, you know the task has completed. Further, the subtask's resources that it owned such as virtual storage and probably ENQs and maybe even Name/Token pairs and such have also gone. The programs it loaded have been deleted, and it is no longer on the TCBTCB chain.

All that you are entitled to assume is that the TCB and the STCB are still extant, and it is still in the TCBOTC/TCBLTC+TCBNTC tree.

The TCB and STCB will be deleted by the DETACH. Before issuing the DETACH, you can harvest the TCBCMP word and the TCBARC word. I have also been known to extract the task's CPU time before issuing DETACH.

The TCBRV316 bit in the TCBCMPF byte will tell you if the abend actually set a reason code.

For the occasions that I code both the attaching task and the attached task, I have been guilty of knowing that the attached task does not issue any user abends, and have consequently used logic which assumes an abend only if the 12 system abend code bits are not all zeros. I expect I should have used the TCBENDINGABNORMALLY bit in the TCBFLGS8 byte.

Cheers,
Greg

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to