Re: Variables to call... (fwd)
Posted in 1994
Topics: General Discussion
Robert Minter (rob@dssmktg.com) wrote: : From Dennis Pimple: : * : * benjamin@rs6a.wln.com (Ben Gardner-Young) writes: ----- bunch of deleted stuff ---- : * >define : * > run_str char(128), : * > foo char(16) : * : * >let foo = "my_func()" : * >let run_str = "call ", foo clipped : * >run run_str : * : * : * This type of functionality currently isn't available, and I think it : * would be very difficult to implement, since function names need to be : * known at compile/link time. You could, of course, make the functions : * seperate executables, then RUN them, passing in appropriate : * parameters. The RUN has the advantage of being background batched, so : * you don't have to wait for one report to complete before firing off : * another one. : Why not CASE it? For example: : CASE : WHEN foo = "my_func" : CALL my_func() : WHEN foo = "your_func" : CALL your_func() : WHEN foo = "our_func" : CALL our_func() : WHEN foo = "noones_func" : CALL noones_func() : OTHERWISE : END CASE : Just a suggestion. Doing this forces you to modify your code every time a new function is created, not a very desirable situation... I ran into a case like this while doing a project for a Master's class, and the best solution I came up with (this is in C++, but I think the same applies for Informix) was to use a CASE statement as above, but to actually generate the code as part of the compile process, constructing a "WHEN" clause based on the entries in a table. It took an interesting shell script to do this, but it worked. I admit this isn't much better than the above solution, but at least the code modification process is done by the compiler, not the programmer. Good luck ... /************************************************************** * Ryan McFall * * Dept. of Computer Science * * Michigan State University * * mcfallry@cps.msu.edu * * * * My statments do not reflect the opinions of MSU, * * Heck, they probably don't even make sense! * *************************************************************/