Re: Variables to call...
Posted in 1994
In article <2l81hpINNkip@emory.mathcs.emory.edu> villy@uunet.uu.net (Will Hartung - Master Rallyeist) writes: >From: villy@uunet.uu.net (Will Hartung - Master Rallyeist) >Subject: Re: Variables to call... >Date: 4 Mar 1994 14:18:17 -0500 >> >Hi folks, >> >I am running 4gl 4.10.UC1 on a Sun and have the following question: >> >Is there not a method to pass variables to the 4gl 'call' routine or >> >construct a string that can be run that contains 'call'? >You need 4.1, a C compiler, and it only works with RDS. But it does work. Not true! You could call a C function and pass it the name of the function ( a string ) and the parameters and that would work in compiled 4gl as well as in RDS. RDS does have the disadvantage of needing to recompile the fglgo runner everytime you want to include a common function into the fglgo runner. >With those prerequisites, class..let's turn to page 203 of our "Informix >4gl Supplement" manual. >There is a chapter on calling 4GL functions from 'C'. If you dig into it >a little bit, it all boils down to a macro "fgl_call(funcname,num_parms)". >Tracking through the .h file fgl_api.h, we find that fgl_call turns into >'p4gl_call("funcname",num_parms)'. This means, that with RDS and a little >help from a C compiler, we can write a function to which we can pass a >string value that contains the name of a function we want executed. >The real difficult part will be the passing of variables, but if all of >your reports uses the same variables, it may not be a problem. Or, of >course, better yet, you have something like: >function rep1() > report xyz(a,b,c) to printer >end function >function rep2() > report zyx(a,b,c,d) to file "hoopla.out" >end function >and then: >prompt "Enter report name (rep1, rep2):" for rep_name >call func_by_name(rep_name) The technique you described should work with the compiled version of 4GL as well as RDS except you don't access fgl_call.