Re: Setting database at runtime with 4GL
Posted in 1995
In article <790623269snz@misslink.demon.co.uk>, simonb@misslink.demon.co.uk (Simon Bunce) wrote: > Is it possible to choose which database to use from within a 4gl program? > > All our source files have a 'DATABASE abc' at the top. So, if we want to > use the same set of source on a different database, we need to change every > occurence of 'abc' to 'xyz' and recompile. Essentially, what we're looking > for is a way of choosing the database at run time. Is it possible? You need to use the DATABASE statement in your 4GL code, then you could pass the name of the database to use as a run-time argument, or via an environment variable: As an argument: As an environment variable: DATABASE abc DATABASE abc MAIN MAIN DATABASE arg_val(1) DATABASE fgl_getenv("DBNAME") END MAIN END MAIN You'll still need to have a database "abc" on your target machines, but it need not have any tables defined in it. > Similarly, can report variables be decided at run time? We have a system > that runs on separate databases in the UK & Canada and currently we have to > change all the PAGE LENGTHs in each country to the appropriate value and > recompile. Appendix J of the FAQ describes a technique to dynamically change report options at runtime. ftp:mathcs.emory.edu:/pub/informix/faq/informix.apx.Z or:kcbbs.gen.nz:/informix/informix.apx.Z Regards, Kerry S --------------------------------------,------------------------------------- Kerry Sainsbury, kerry@kcbbs.gen.nz | THE INFORMIX FAQ Quanta Systems, Auckland, New Zealand | kcbbs.gen.nz:/informix/* | mathcs.emory.edu:/pub/informix/faq/* +64 9 377-4473 (work) 276-5546 (home) | quasar.ucar.edu:/?