SQLCODE and the exit() call

To return an error code to a parent process, do not attempt to use the SQLCODE value as an argument to the exit() system call. When passes back the argument of exit() to the parent, it passes only the lower eight bits of the value. Since SQLCODE is a four-byte (long) integer, the value that returns to the parent process might not be what you expect.

To pass error information between processes, use the exit value as an indication that some type of error has occurred. To obtain information about the actual error, use a temporary file, a database table, or some form of interprocess communication.