Re: Setting database at runtime with 4GL
Posted in 1995
---- original message from Kerry Sainsbury ---- ++ ++ 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 *** WARNING *** The above syntax won't work with ISTAR/INET. You must ALWAYS close a database before opening a new one. There is also a know bug on some platforms (Motorola is one that I know of) in version of 4.11 or below of RDS where a close database will cause a -408 error when used in conjunction with ISTAR/INET. -- Jerry M. Denman -- Director of Special Projects Sherwood Systems (a division of Sherwood Mfg Co. Inc.) jerry@sherwood.com ------------------------------------------------------------------------------ The manner in which one endures what must be endured is more important than the thing that must be endured. - DEAN ACHESON