Page 1 of 1

Need help with ABEND RC=S806 RSN=4 and signal handler

PostPosted: Fri Feb 09, 2018 12:36 am
by chong_zhou
I have a program written in LE C, executed with POSIX(ON) in a batch job. This program uses a DLL, linked with a SIDE-DECK file.

When the DLL it depends on does not exist, the program ended up with ABEND S806/RSN-4, the dump writes:

DESCRIPTION: S806 - A MODULE REQUESTED BY THE PROGRAM COULD NOT BE FOUND.


OK, nothing surprise till now.

But from the SYSPRINT of the job log I noticed that the program actually executed, it even printed out some message until it called the function in the DLL and ABENDed with S806. Therefore I wanted to 'catch' the error and print more error message in order to let it ABEND more gracefully?

I tried to setup signal handler for SIGABEND using the following snippet:

void myHandler(int codeAbend)
{
    printf("ABEND %d\n", codeAbend);
    exit(4);
}
...

struct sigaction info,newhandler;
newhandler.sa_handler = myHandler;
sigemptyset(&newhandler.sa_mask);
newhandler.sa_flags = 0;
sigaction(SIGABND, &newhandler, &info);
 


But neither was the error message printed out, nor was the exit code changed to 4. It still ABENDed with S806.

I checked the return code of sigaction(), it was 0, not SIG_ERR. I also tried ANSI function signal(SIGABND, myHandler), but I still did not make it.

Finally I tried to raise the signal on my own by raise(SIGABND). This is time my program caught the ABEND.

Is there anything I did wrong? Or this kind of ABEND simply cannot be caught at all? If so, why doesn't IBM's document mention it? :x

Thank you guys very much!
Edited as to font and code tags

Re: Need help with ABEND RC=S806 RSN=4 and signal handler

PostPosted: Fri Feb 09, 2018 2:02 am
by Robert Sample
Do not post on multiple fora. The same people who respond on this one also read the other one. Topic locked.