Re: UNIX SYSTEM CALLS FROM 4G
Posted in 1995
>From: jschumac@uns-dv1.informix.com (Joel Schumacher) >Date: 24 Jul 1995 14:53:50 GMT >X-Informix-List-Id: <news.15681> > >Just a warning on return values: > >We're using compiled 4GL Version 4.11.UC3 on Solaris. So you are using an old, out of date version. >If your program runs without problems, but does not end with an EXIT >PROGRAM statement, ie. (EXIT PROGRAM 0, or EXIT PROGRAM 5), the return >code will be the number of parameters on the command line. For example: > >Command Line Return value if no EXIT PROGRAM specified >-------------------------- ----------------------------------------- >myprog.4ge 1 >myprog.4ge abc def 3 Or some other random number; it depends on what happens to be lying around in the registers -- it might, on some machines, be consistently the number of parameters, but it is not necessarily that value. >I've been told that it's a known bug on *some* systems. So, the point >is if you rely on return codes, don't assume your program will exit with >0 when you hit the END MAIN statement. Code for an EXIT PROGRAM 0. You may rely on there being an explicit "return(0)" in the generated C code if your version of I4GL is more or less current -- meaning 4.12.UE1 or later. This achieves the effect of EXIT PROGRAM 0. Your warning, Joel, is only valid for old versions of I4GL. Of course, this does not alter the values received by the I4GL program in response to 'RUN cmd RETURNING run_status'; that still gets whatever status is returned by the program. If it happens to be an old-version I4GL, that may not be what you expected, but it is the status from the program. The returned value still has the multiplied-by-256 behaviour because that is now the correct, documented behaviour. This was correctly documented in the excised portion of the message to which this is a response. And none of this has anything very much to do with the original question which asked about system calls -- meaning section 2 of the Unix Programmer's Manual -- which are not callable directly from I4GL. Yours horribly pedantically, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>