Re: Set an environment variable from within a 4GL program?
Posted in 1995
Topics: Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL
junet@informix.com (June Tong) wrote: >Ajay Chitale <achit@rtsg.mot.com> wrote: >>proberts@lynx.informix.com (Paul Roberts) writes: >>> >>> Can I set an environment variable from within a 4GL program and have >>> it be `effective' in the subsequent running of the program? >> >>All you can do is link your 4gl code with a 'c' routine which will >>set your environment as per your needs. >Maybe, but if you're planning on setting any environment variables that >Informix uses, I'm pretty sure Informix reads them when you start up your >application, so anything you change in the application will never be read. The above paragraph is both misleading and 100% WRONG. Setting or changing any environment variable will work just fine, 100% of the time. Even environment variables that are mission-critical to Informix's well-being, such as DBPATH can be changed on the fly. I have a database system with 1200+ identical databases, and I reset environment variables AS THE SOLE MECHANISM FOR SWITCHING BETWEEN DATABASES WITHIN THE SYSTEM. The inital settings CAN be overridden, and will stay in their changed state until changed again, or Informix is exited. If you exit the application, your environment variables return to their "original" (pre-changed) state, but you can change them again based upon a homebrew "parameter file" on subsequent (later) invocations of Informix by the same user, groups of users, or all users. With several thousand users beating on my DB every day, I can assure you that the approach is bullet-proof. E-mail me if you want source. ------- If you cut here, your display may implode ----------- ______________ /\\ ___________\\ This writer's statements are definitive. \\ \\ \\________ / Recent findings in physics have proven the \\ \\ \\ / / / universe to be inherently random. If this \\ \\ \\ / / / writer's statements conflict with reality, \\ \\ \\/ / / this may well be due to the inherently \\ \\/ / / random nature of reality itself, rather James \\ / / than any error on the part of the author. Fischer\\/_/ jfischer@inmind.com