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



Help for C/C++ for MVS, OS/390 C/C++, z/OS C/C++ and C/C++ Productivity Tools for OS/390

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

Postby chong_zhou » Fri Feb 09, 2018 12:36 am

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
chong_zhou
 
Posts: 40
Joined: Wed Nov 01, 2017 8:59 pm
Has thanked: 21 times
Been thanked: 0 time

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

Postby Robert Sample » Fri Feb 09, 2018 2:02 am

Do not post on multiple fora. The same people who respond on this one also read the other one. Topic locked.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times


Return to C, C++

 


  • Related topics
    Replies
    Views
    Last post