Set an environment variable from within a 4GL program?
Posted in 1995
TIPASQB (this is probably a silly question but): Can I set an environment variable from within a 4GL program and have it be `effective' in the subsequent running of the program? The way I am used to doing things is: programs have "front-end scripts" which set whatever variables need to be set, and then kickoff the executable. The application can read the value of an environment variable via a function called, er, something or another. What am I trying to do? I'd like to have my program start off by asking "which currency are we dealing with today?". If the user picks D. Marks then I want to set DBMONEY to "DM," so that subsequent forms with money fields will show "DM" as the prefix and "," instead of "." to indicate the fractional part. Something that obviously won't work is let currency_format = 'DM,' { table-driven } run "setenv DBMONEY currency_format" because it will be effective only in the subshell that is created by the 'run' statement. I suppose I could have a program that allows the user to select "which currency?" and then another program that does all the rest of the work, and have the first program do a run "setenv DBMONEY currency_format ; second_program.4ge" but this seems rather ugly. Is there a function that will allow me to set the value of the environment variable within the current shell? Thanks ... Paul