Re: ENV. variable in 4GL
Posted in 1995
In <3psq83$qa8@cssun.mathcs.emory.edu> omer@rorqual.cc.metu.edu.tr (Omer OZTAN) writes: >>Hi INFORMIX' ers >> >> how I store enviroment variable (i.e. DBPRINT) in >> a 4gl program variable........? >> >> regards > there is a command called RUN which executes unix shell command > RUN <unixShellCommandString> >for example : RUN "ls -l" gives the file list of the current directory, > or RUN "DBPRINT=lp" > RUN "export DBPRINT" sets the environment variable DBPRINT from > your 4gl code. Won't work. Environment variables are inherited from parent to child processes only -- "run" runs a child, so its own env would be set, but then that child immediately exits. Like ordinary genetic characteristics, you can't inherit from your children. (Only insanity is reportedly inheritable from children. :-) You could set it for one process, e.g., RUN "DBPRINT=foo lp filename", but it would only work for that lp process, not 4gl. A better solution would be to wrap up the putenv() function for use in 4gl (if your C library has one; else you get to write one or find one elsewhere). The question then becomes when does 4gl look at the var -- at process startup or each usage; I don't know, may depend which variable you're talking about, etc. -- Andrew Burt aburt@du.edu "Oh, what sad times are these when passing ruffians can say 'Ni' at will to old ladies."