Re: Setting database at runtime with 4GL
Posted in 1995
In article <NbC8lq4b9dXG075yn@kcbbs.gen.nz>, kerry@kcbbs.gen.nz (Kerry Sainsbury) wrote: > > 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. Ooops! I forgot to mention you'll need to add: PREPARE close_database FROM "CLOSE DATABASE" EXECUTE close_database directly after the MAIN clause, otherwise you'll have problems when running over a network or with some 4GL ports (Sun pops into mind) 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) | http://www.garpac.com/informix.html