Page 1 of 1

Changing values of Environmental variables at run time

Posted: Fri Apr 09, 2010 12:59 am
by swerajan
Hi,

I need to change the value of an environment variable at runtime. How can i achieve this? How can i chnage the values of them in a parm files in unix. I am using parameter sets and parameter value files in datatstage, and corresponding paramfiles in unix.

Posted: Fri Apr 09, 2010 1:51 am
by ray.wurlod
You can change them, but the values used by your job won't change because they're read into the job processes' memory when the job starts.

So please confirm your reason for wanting to change environment variables or parameter values once the job is running. Then maybe we can look at techniques.

Posted: Fri Apr 09, 2010 2:00 am
by swerajan
I am using an Oracle enterprise stage to load data into table using RCP. This does not have an inbuilt commit. So we are using the APT_ORA_UPSERT_COMMIT_LEVEL environment parameter. Based on the load size we may need to change this value. this is the requirement behind changing the environment value.

Posted: Fri Apr 09, 2010 2:15 am
by ShaneMuir
You should be able to use a pre job routine to get the parameter value from a unix file, and overwrite the default value.

You would include the environment variable as a parameter in the job and then your pre job routine would overwrite whatever you have set the default as.

We use a similar logic here, whereby we overwrite the apt_config_file environment variable from $PROJDEF to which ever config file we wish.

Posted: Fri Apr 09, 2010 6:29 am
by swerajan
can you please explain more about the approach?

Posted: Fri Apr 09, 2010 6:31 am
by chulett
Add the $APT variable as a job parameter, then it can then be changed at runtime in that job's environment (and just for that run) just like any other parameter.

Posted: Fri Apr 09, 2010 8:53 am
by DSguru2B
An easier way would be to set the the default value of the parameter as $ENV and in the before job subroutine, invoke a script that does nothing but set these parameter values, eg: export $myVar = something.

Posted: Fri Apr 09, 2010 6:12 pm
by ray.wurlod
But it remains the case that a running job reads the values when it starts, and will not pick up any changes made while it's running.

So what you want to accomplish must be wrought prior to the job starts.