Re: How to get return Val from Shell prog
Posted in 1996
On Tue, 16 Apr 1996 13:44:53 -0400, praveen@qsun.ho.att.com wrote: > > I have a 4GL program that, executes a shell script > > using RUN statement, the shell scripts exits with a > > value if an error occurs. I want to get that value > > back into my 4GL program. Is there a way to do it ? > > On my system (SCO 3.2.4.2) the following works: > DEFINE r_status INTEGER > RUN <command-line> RETURNING r_status > LET r_status = r_status / 256 > > On SCO, the return status is actually made up of two parts: 8 bits > for your return value and 8 bits for Unix flags. Dividing by 256 > rotates the Unix flags off and shifts your return value to its > "proper" position. I don't know this tobe true of all operating > systems though! Try it and find out. This is something that I wish was better documented in TFM. (I think I'll go find them and tell them about it!) :) Anyway, in the version that comes to hand, the appropriate manual is: "Informix-4GL Reference Manual" Volume 2, version 4.00, page 7-215: RUN command Part number 000-7045 It's also interesting to read the manual for calling c functions: "Informix-4GL by Example" version 4.10, Chapter 13 part number 000-7022 and the "Informix-4GL Release 4.1 Reference Manual Supplement" As an exercise, I'll often try to find the answers to questions like these in TFM, even if a response has been posted. I wish more users would do the same! ;) Good luck, __________________________________________________________________ | Clem Akins clema@informix.com | | International Support formerly | | Informix Software, Inc cwakins@leia.alloys.rmc.com | | Menlo Park, California, USA Standard Disclaimers Apply | |________________________________________________________________|