4GL program and C code
Posted in 2000
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Hello everyone, I have some special calculation need to be done by C code, and I would like to return to 4GL program. I am running with RDS 4GL compiler, according to reference manual, It looks like I can return INTEGER from RUN command. Some machine can be only return the integer which less than 256. Can someone give hint on how to pass argument and return value between C code and 4GL program?
Of course you can create a custom runner, but that may be more trouble than you
want to go to.
Another option is to create a ascii file with the C program and then shell a
dbload or dbaccess command to insert the calculated value in a table. Upon
returning to the 4gl, just select value from table and use it as required.
Hope this helps.
Rex Arnold
"W. J. Hsu" wrote: > Hello everyone, > > I have some special calculation need to be done by > C code, and I would like to return to 4GL program. > I am running with RDS 4GL compiler, according to > reference manual, It looks like I can return INTEGER > from RUN command. Some machine can be only > return the integer which less than 256. > Can someone give hint on how to pass argument > and return value between C code and 4GL program? As RexArnold suggested, the best way to do it is to call the C code directly as a function from a custom runner, rather than trying to run a separate program. If you must use a separate program, then you can either have the separate program put the data into a table (permanent table) in the database for the calling program to pick up, or yuou can have it generate a file in UNLOAD format and LOAD it (again, as RexArnold suggested). The return status from a RUN program is for indicating success or failure, not for communicating real results. If you really insist on using it, then you can run the program 4 times with a different argument each time, and have the separate runs each return a different byte of the result. You can then reassemble the results from the individual bytes. No -- I didn't mean you should go try it! -- Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) Guardian of DBD::Informix v1.00.PC1 -- see http://www.perl.com/CPAN #include <disclaimer.h>