Re: Can different versions of a db be passed into a form?
Posted in 1997
Hi, >From: "g. ggonyeau" <ggonye1@alumni.umbc.edu> >Date: 18 Jun 1997 23:32:06 GMT >X-Informix-List-Id: <news.39383> > >Let me start be saying that I am new to informix and 4gl. OK. The FAQ is available at http://www.iiug.org. Somewhat to my surprise, I don't think it covers what you're asking. >I am working with in a multiple version site in AIX. For example version >a, b, c ... etc of the same database but unique date to each. How can I >use a single form against each of databases? Please help... I'm having to guess what you're asking. My translation is: I am working with multiple databases on an AIX site. For example, I have databases a, b, c, ... each of which has the same schema but different data. How can I use a single I4GL program against any of the databases? If my translation is incorrect, then ignore the rest of this answer and give us the correct translation. The basic answer is that you compile your programs (I4GL source code and form files) against one of your databases, a, for example. Then, at run time, your programs inspect an environment variable (or command line argument) and decide which database should be used. As long as the schemas in each database are the same, this will work without problems. I4GL automatically opens the database for you when the file containing MAIN starts something like: DATABASE a ... MAIN Since you don't necessarily want database a opened, maybe you should modify your code, modifying the current MAIN to a function real_main(), and writing a new, ultra simple MAIN in a file which contains: MAIN DEFER INTERRUPT -- Must be in MAIN! DEFER QUIT -- Must be in MAIN! CALL open_database() CALL real_main() EXIT PROGRAM 0 END MAIN You can use this file a part of every one of your programs, simply by listing it as one of the object files and by ensuring that your programs each supply a real_main() function. Because there is no DATABASE statement in the code, no database will be opened when the program is started. The code in the library function open_database() (which you will write) will access the correct database using whatever logic you decide is best for you. Variants on this technique can be used, and have been used, by many people for a long time. Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>