DATABASE statement catch-22
Posted in 1994
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
I think I'm screwed on this, but I figured I'd check... I have a 4GL program (written under RDS 4GL 4.10) that has a set of defines at the beginning using the LIKE keyword, immediately following the DATABASE statement. Example: DATABASE fubar1 DEFINE om30cus LIKE omlic.om30cus . . MAIN . . END MAIN I have a new requirement for this program that requires that this program be useable under any of our databases, fubar_1 through fubar_5, all of which have the same schema. Is there a way I can do this that I'm missing? I can't call ARG_VAL() before this, so I can't pass the database name as a command line argument. I've got a function that will extract the current database from an environment variable, but I can't call that yet, either. Simple defining the variables as the same type as the database fields means the program loses knowledge of the tables I'm working with. Defining these variables in each of my functions is redundant, and loses the "globality" of these variables. If I define the variables as above, then in my MAIN function close the database, call my sysinit() function which puts the current database name in my dbname variable, and give the command DATABASE dbname, the program drops the definition of om30cus, and I am unable to access it. I hate to end up with 5 different versions of the program, one for each database, but I can't see any other way. If you have a different approach, PLEASE EMAIL ME at jh@cadre.com. Our newsfeed runs about a week behind, so simply replying to this in news won't be very helpful, I'm afraid. Thanks for any hints you can pass along! --- =============================================================================== Joe Hartley | jh@cadre.com - Whenever you find that you are on the Cadre Technologies | side of the majority, it is time to reform. - M. Twain 222 Richmond St. | -------------------------------------------------------- Providence, RI 02903 | Overman 1st Class - the Kilgore Trout Memorial Clench (401) 351-5950 x266 | of the Church of the SubGenius ===============================================================================