return code after interrupt
Posted in 1994
Topics: Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL
We have a number of 4gl programs, shell scripts, C and EC programs that we run from a menu program. The menu program runs the scripts and programs out of the bourne shell, and produces an error message including the return code if the return code is anything other than 0. One of our users reported that when he presses the delete key in a 4gl program, it gives an error message with a return code of 208. This happens even when the delete key is pressed in a second 4gl program that was run from within the first 4gl program using the RUN command. We use defer interrupt, set the interrupt flag to false, and exit with an explicit 0, but still get the error 208 message. If I run the program from the command line (using ksh), then echo $? to get the return code, it displays 0. If I do the same thing from the bourne shell, I get a return code of 2000. I assume that the menu program is using a char to store the return code (I haven't seen the source, but surmised that, since 2000 wraps to 208 with an 8 bit char). What I don't understand is why are we getting a return code other than 0 when we run a 4gl program using the bourne shell, and is there an easy way out of this that I'm just not seeing? One way out would be to rewrite the menu to use ksh, but doing that would require all the programs it runs to be retested using ksh, and the shell scripts might be a bit tricky. I suppose we could rewrite the shell scripts to include #!/usr/bin on the first line, and use ksh for the programs, but we would still need to retest everything, and there are probably several hundred programs involved altogether, so we would prefer to avoid that. Any suggestions? Thanks-- Brian Green (briang2621@aol.com)