Hi all,
we have an old RPG OPM project. The project is very sensitive. So sensitive that we cannot allow any unhandled exceptions to happen. So I was thinking to wrap every call to the project's programs in a C program (I don't know RPG good enough), that will handle signals in the following way:


#pragma map(action, "PROGA")
#pragma linkage(action, OS)

jmp_buf jumper;
void action (......)

void signal_handler (int signum)
{
 longjmp(jumper, 1);
}

int main(int argc, const char **argv) {
 struct sigaction act, old;

 /* Set up the signal handler */
 act.sa_handler = signal_handler;
 act.sa_flags = 0;
 sigemptyset (&act.sa_mask);
 sigaction (SIGSEGV, &act, &old);

 if (setjmp(jumper) != 0){
   sigaction (SIGSEGV, &old, NULL);
   printf("General error: SIGSEGV occured");
   // allways return with success
   return EXIT_SUCCESS;
 }

 // CALL RPG program here
 action (...) ;
}

Is it the correct approach at all?
If yes, is SIGSEGV signal enough to handle all possible exeptions in RPG program?



Thanks in advance.




This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].