Values Returned by 4gi module ?
Posted in 1999
Topics: General Discussion
I'd like to know the distint way to return values from a 4gi module to another one, and how to can retrieve this values from the 4gi original. ( I want to create a custom calling a 4gi module and it will return the custem code. I want it be greater 32 bytes ) Advanced Thanks.
I'm not sure what you mean by "module" I'm guessing that actually mean a 4gi program. In the code you can EXIT PROGRAM l_return_code but the variable l_return_code must be an integer and the receiving program needs to divide it by 256 after receiving it. At least this is the case with my versions. -- --------------------------------------- Tony Flaherty aef@mfs.misys.co.uk Analyst Programmer Misys Financial Systems All statements and opinions are my own, Misys don't pay me enough to have opinions on their behalf . jjcarrasco@geuropa.com wrote in message <374BAEAA.96142085@geuropa.com>... >I'd like to know the distint way to return values from a 4gi module to >another one, and how to can retrieve this values from the 4gi original. > >( I want to create a custom calling a 4gi module and it will return the >custem code. I want it be greater 32 bytes ) > >Advanced Thanks. > >
Tony Flaherty wrote in message <927901471.13741.1.nnrp-10.c1ed1f69@news.demon.co.uk>... >I'm not sure what you mean by "module" I'm guessing that actually mean a >4gi program. In the code you can EXIT PROGRAM l_return_code but the >variable l_return_code must be an integer and the receiving program needs to >divide it by 256 after receiving it. At least this is the case with my >versions. > Yes, it will, but probably not suitable for this need. My approach would be to communicate via a database table set up to do that. the 1st program would insert a row into the table, get the serial value of the inserted row, and RUN the 2nd program, passing it the serial value. The 2nd program would fetch what information it needs based on the passed serial number, do the processing required, update the row in the table, and exit. The next line after the RUN statement (no "without waiting" clause, natch) could then refetch from the table and read the result. The only other caveat I can think of is to make sure you're not in a transaction during all this, or the 2nd program (with a different engine instance) won't see the row. > >. >jjcarrasco@geuropa.com wrote in message <374BAEAA.96142085@geuropa.com>... >>I'd like to know the distint way to return values from a 4gi module to >>another one, and how to can retrieve this values from the 4gi original. >> >>( I want to create a custom calling a 4gi module and it will return the >>custem code. I want it be greater 32 bytes ) >> >>Advanced Thanks. >> >> >
Tony Flaherty wrote: > I'm not sure what you mean by "module" I'm guessing that actually > mean a 4gi program. In the code you can EXIT PROGRAM l_return_code > but the variable l_return_code must be an integer and the receiving > program needs to divide it by 256 after receiving it. At least this > is the case with my versions. You're right, and it applies to all versions of I4GL-RDS. The value returned via 'RUN cmd RETURNING value' is strictly limited to the values 0..255. The fact that a 16-bit number is returned is an artefact of the Unix wait() call, which encodes signal and core dump information in the low-order 8 bits of the value, and the exit status in the high-order 8 bits of the value. If you need to return arbitrary amounts of data (more than 255 values) from one program to another, you are going to have to devise some alternative mechanism. You have three main candidates - a table in the database, a pipe connection, or a file in the o/s. It is easier to access tables than files or pipes in I4GL, so I'd probably go down that route. > jjcarrasco@geuropa.com wrote: > >I'd like to know the distint way to return values from a 4gi > >module to another one, and how to can retrieve this values from > >the 4gi original. > > > >( I want to create a custom calling a 4gi module and it will > >return the custem code. I want it be greater 32 bytes ) -- Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) Guardian of DBD::Informix v0.60 -- see http://www.perl.com/CPAN #include <disclaimer.h>
In article <374BAEAA.96142085@geuropa.com>, jjcarrasco@geuropa.com wrote: > I'd like to know the distint way to return values from a 4gi module to > another one, and how to can retrieve this values from the 4gi original. > > ( I want to create a custom calling a 4gi module and it will return the > custem code. I want it be greater 32 bytes ) > > Advanced Thanks. > > If your program doesn't do any screen handling you can do it easy enough by just DISPLAYing it, e.g. in your shell script (assuming you're using Unix): RETVALUE=`fglgo program1` fglgo program2 $RETVALUE In program1.4gl the last line would be something like: DISPLAY l_return_code Otherwise, as already suggested, your best bet would be a table or temporary file. -- Alf Nathan Sent via Deja.com http://www.deja.com/ Share what you know. Learn what you don't.