RE: 4GL question
Posted in 2000
Topics: Error Codes & Troubleshooting, Connectivity: ESQL/C, 4GL & Embedded SQL, Versions, Editions & End-of-Life
Do you mean propagated back to the shell through $? (this is the only way I know of signal information of a called process is passed on) As far as I know trap only catches signals sent to the shell. It would seem bad for 4GL to send the signal it received directly to the parent, things like a SIGSEGV would cause problems. I have only done a little programming with signals, I am not claiming to be an expert. Am I misinterpreting what you said or ignorant on some point? Will >===== Original Message From "Mark D. Stock" <mdstock@mydas.freeserve.co.uk> ===== >"Carlson@WHSmith" wrote: >> >> For all the 4GL gurus out there: >> >> HPUX 10.20 >> IDS 7.30.uc7 >> 4GL 7.20.ud6 >> >> I'm looking to return error codes from a 4GL program to the shell. >> While I can trap and return an error code using "exit program", is there >> a way to trap an error code if the program was killed, crashed, etc.??? > >As I remember you can do this with a shell wrapper and a carefully coded >trap command. Interrupts are just that and will therefore never reach >your EXIT PROGRAM. However, they are (or were) propagated back to the >shell script. Don't trap too much otherwise the shell script will lock >up. Sorry I don't have any examples. > >Cheers, >-- >Mark. > >+----------------------------------------------------------+-----------+ >| Mark D. Stock mailto:mdstock@mydas.freeserve.co.uk |//////// /| >| http://www.informix.com http://www.informixhandbook.com |///// / //| >| http://www.iiug.org +-----------------------------------+//// / ///| >| |What year 2000 bug? year 2000 bug? |/// / ////| >| |year 2000 bug? year 2000 bug? year |// / /////| >| |2000 bug? year 2000 bug? year 1900 |/ ////////| >+----------------------+-----------------------------------+-----------+ ------------------------------------------------------------ This e-mail has been sent to you courtesy of OperaMail, as a free service from Opera Software, makers of the award-winning Web Browser, Opera. Visit us at http://www.opera.com/ or our portal at: http://www.myopera.com/ Your free e-mail account is waiting at: http://www.operamail.com/ ------------------------------------------------------------
William Rice wrote: > > Do you mean propagated back to the shell through $? (this is the only way > I know of signal information of a called process is passed on) > That's it . . . . I'm aware of the 'exit program' functionality, but that presupposes a planned exit from the program. I'm looking for a way to trap an unexpected "program clobber" (e.g.. KILL, instance drops, etc.) and send it back to the shell. > > >===== Original Message From "Mark D. Stock" <mdstock@mydas.freeserve.co.uk> > ===== > >"Carlson@WHSmith" wrote: > >> > >> For all the 4GL gurus out there: > >> > >> HPUX 10.20 > >> IDS 7.30.uc7 > >> 4GL 7.20.ud6 > >> > >> I'm looking to return error codes from a 4GL program to the shell. > >> While I can trap and return an error code using "exit program", is there > >> a way to trap an error code if the program was killed, crashed, etc.??? > > > >As I remember you can do this with a shell wrapper and a carefully coded > >trap command. Interrupts are just that and will therefore never reach > >your EXIT PROGRAM. However, they are (or were) propagated back to the > >shell script. Don't trap too much otherwise the shell script will lock > >up. Sorry I don't have any examples. > > > >Cheers, > >-- > >Mark. > > > >+----------------------------------------------------------+-----------+ > >| Mark D. Stock mailto:mdstock@mydas.freeserve.co.uk |//////// /| > >| http://www.informix.com http://www.informixhandbook.com |///// / //| > >| http://www.iiug.org +-----------------------------------+//// / ///| > >| |What year 2000 bug? year 2000 bug? |/// / ////| > >| |year 2000 bug? year 2000 bug? year |// / /////| > >| |2000 bug? year 2000 bug? year 1900 |/ ////////| > >+----------------------+-----------------------------------+-----------+ > > ------------------------------------------------------------ > This e-mail has been sent to you courtesy of OperaMail, as a free service from > Opera Software, makers of the award-winning Web Browser, Opera. Visit us at > http://www.opera.com/ or our portal at: http://www.myopera.com/ Your free e-mail > account is waiting at: http://www.operamail.com/ > ------------------------------------------------------------ -- John Carlson Informix DBA WHSmith USA #include std_disclaimer.h /* These are my opinions, not my company's opinion */
Surely though kill can't be trapped. If the instance dies then the 4gl can call it's own internal handler and exit accordingly. Below, hopefully the chunk of esql below should allow you to look at trapping the trappable signals and tidying up. It might be useful, it's very old though #include <stdio.h> #include <signal.h> / $include sqlca; #define ERROR sqlca.sqlcode #define CISAM sqlca.sqlerrd[1] main(argc, argv) int argc; char *argv[]; { $char dbname[18]; int sighand(); signal(SIGHUP, sighand); signal(SIGINT, sighand); signal(SIGQUIT, sighand); signal(SIGFPE, sighand); signal(SIGBUS, sighand); signal(SIGSEGV, sighand); signal(SIGTERM, sighand); /* The above could be replaced by { int i; for(i=1; i<NSIG; i++) signal(i, sighand); } */ sprintf(dbname,"%s", argv[1]); $database $dbname; /* The main code lives from here */ $close database; } int sighand() /* signal handling function */ { sqlbreak(); sqlexit(); exit(1); } "Carlson@WHSmith" wrote: > > William Rice wrote: > > > > Do you mean propagated back to the shell through $? (this is the only way > > I know of signal information of a called process is passed on) > > > > That's it . . . . > > I'm aware of the 'exit program' functionality, but that presupposes a > planned exit from the program. I'm looking for a way to trap an > unexpected "program clobber" (e.g.. KILL, instance drops, etc.) and send > it back to the shell. > > > > > >===== Original Message From "Mark D. Stock" <mdstock@mydas.freeserve.co.uk> > > ===== > > >"Carlson@WHSmith" wrote: > > >> > > >> For all the 4GL gurus out there: > > >> > > >> HPUX 10.20 > > >> IDS 7.30.uc7 > > >> 4GL 7.20.ud6 > > >> > > >> I'm looking to return error codes from a 4GL program to the shell. > > >> While I can trap and return an error code using "exit program", is there > > >> a way to trap an error code if the program was killed, crashed, etc.??? > > > > > >As I remember you can do this with a shell wrapper and a carefully coded > > >trap command. Interrupts are just that and will therefore never reach > > >your EXIT PROGRAM. However, they are (or were) propagated back to the > > >shell script. Don't trap too much otherwise the shell script will lock > > >up. Sorry I don't have any examples. > > > > > >Cheers, > > >-- > > >Mark. > > > > > >+----------------------------------------------------------+-----------+ > > >| Mark D. Stock mailto:mdstock@mydas.freeserve.co.uk |//////// /| > > >| http://www.informix.com http://www.informixhandbook.com |///// / //| > > >| http://www.iiug.org +-----------------------------------+//// / ///| > > >| |What year 2000 bug? year 2000 bug? |/// / ////| > > >| |year 2000 bug? year 2000 bug? year |// / /////| > > >| |2000 bug? year 2000 bug? year 1900 |/ ////////| > > >+----------------------+-----------------------------------+-----------+ > > > > ------------------------------------------------------------ > > This e-mail has been sent to you courtesy of OperaMail, as a free service from > > Opera Software, makers of the award-winning Web Browser, Opera. Visit us at > > http://www.opera.com/ or our portal at: http://www.myopera.com/ Your free e-mail > > account is waiting at: http://www.operamail.com/ > > ------------------------------------------------------------ > > -- > John Carlson > Informix DBA > WHSmith USA > > #include std_disclaimer.h /* These are my opinions, not my company's > opinion */ -- Paul Watson # WF Software Ltd # You are only young once Tel: +44 1436 674728 # but you can be immature Fax: +44 1436 678693 # for ever www.wfsoftware.com #