Changing values of Environmental variables at run time

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
swerajan
Participant
Posts: 42
Joined: Tue Aug 05, 2008 4:34 am

Changing values of Environmental variables at run time

Post 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.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
swerajan
Participant
Posts: 42
Joined: Tue Aug 05, 2008 4:34 am

Post 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.
ShaneMuir
Premium Member
Premium Member
Posts: 508
Joined: Tue Jun 15, 2004 5:00 am
Location: London

Post 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.
swerajan
Participant
Posts: 42
Joined: Tue Aug 05, 2008 4:34 am

Post by swerajan »

can you please explain more about the approach?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post 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.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply