Re: Changing the ENV.
Posted in 1995
Topics: Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL
Robert Minter writes: > For all who are curious, how do you alter the environment while running > a 4gl program? I've tried this: > > MAIN > DEFINE arg_str CHAR(20) > LET arg_str = fgl_getenv("ROBS_ENV") > DISPLAY "arg_str = ", arg_str CLIPPED > RUN "ROBS_ENV=hello ; export ROBS_ENV" > LET arg_str = fgl_getenv("ROBS_ENV") > DISPLAY "arg_str = ", arg_str CLIPPED > END MAIN ............ Well, those who know the way Unix processes are created and executed won't have problems in understanding the problem. Still for others: Whenever a RUN command is issued the running process creates a child process in which given shell command is executed. Here **attempted** setting of environment variable will be run as a command in a newly created shell process of which the parent process (the process which issues RUN command) has no knowledge. The workaround would be to extend your 4GL and use a "C" function which will in turn call UNIX system call "int putenv(char *str)" where str is of the form "variable=value". Hope this clears the doubts. Girish ========================================================================== Standard disclaimers apply.