Re: Set an environment variable from within a 4GL program?
Posted in 1995
}
} 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.
The thing to keep in mind is, of course, that is if you change the environment
variable with something like:
LET cmd_strng = "export DBPATH=//server"
RUN cmd_strng
It will work just great, the child process will now know that
DBPATH="//server". But... the child process has now terminated.
cheers
j.
Hey! My display didn't explode, what gives?
_____________________________________________________________________________
Jack Parker yauib* - Hewlett Packard, BSMC Boise, Idaho, USA
jparker@hpbs3645.boi.hp.com
_____________________________________________________________________________
* yet another unix/informix bigot
_____________________________________________________________________________
Any opinions expressed herein are my own and not those of my employers.
_____________________________________________________________________________