Re: 4GL and $DBNAME
Posted in 1998
On Mon, 22 Jun 1998, Bruce McDougald wrote: > I want to write 4gl code that will grab the database name from an env. > variable at compile time. My problem is that the compiler is choking on > my variable definitions. Is there a way around this? > > EX: > main > call init() > call process() > end main > > function init() > define dbname > let dbname = fgl_getenv("DBNAME") > > database dbname > end function -- split here -- see below -- > function process() > define l_var like table.column ## Compiler will choke here > .... > end function Yes. I explained it in this forum during this year, but I'll do it again... Actually, you've done the hardest work. All you have to do is split your code into two files at the point I've marked. In the second file, you add the non-procedural DATABASE statement which tells the compiler where to look at compile time for the database structure (things defined LIKE something in the database). At run-time, your code in the first file will select the required database; as long as it is structurally equivalent to the compile-time database (so the bits of the compile-time database used by your program are the same in the run-time database), then all is hunky-dory. For more info, go to DejaNews and hunt the previous postings down. For example, one was on 28th May 1998. Yours, Jonathan Leffler (jleffler@informix.com) #include <witticism.h> Guardian of DBD::Informix -- see http://www.perl.com/CPAN