Page 1 of 1

$ENV parameter value

Posted: Wed Sep 24, 2003 1:27 am
by manavkumarm
Hi all,

I wish to set some environment variables of my own in UNIX (shell command in my local.profile) and use them in a server job. Any idea how I could accomplish this? I heard the $ENV special parameter value can be utilized for this.

Thanks,
Manav

Posted: Wed Sep 24, 2003 4:19 am
by ray.wurlod
In DataStage version 6 and later, when you're specifying a job parameter, there is a command button called "Add Environment Variable". Use this.

Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518

Posted: Thu Sep 25, 2003 3:23 am
by manavkumarm
Adding the Environment Variable as a parameter to a job is simple enough, but I am unable to figure out exactly where I can set the values of these env variables before I run the job, so that the job runs with the value I specify. When I run the job with the special value $ENV, it is supposed to pick up the existing value of the env var, but I just can't figure out where it picks up the value from. Setting the variable on the UNIX command line doesn't work, and neither does setting it in my Project options in the Datastage Administrator. Any pointers?

Posted: Thu Sep 25, 2003 10:26 am
by chulett
With Version 6+ you can add or override Environment variables at runtime. Check the online help, especially the "Choose Environment Variable List" entry.

When you setup a new (or override an existing) variable, it becomes a parameter to the job. Set it to what you want it to be when the jobs runs, just like any other parameter. The "special" $ENV value is only used when you *don't* want to override the current value of the variable - from the help, it "instructs DataStage to use the current setting for the environment variable".

HTH,

-craig

Posted: Fri Sep 26, 2003 8:45 am
by manavkumarm
Can anyone tell me how to set the variable after I have added it to the parameter list of the job? I do not want to override its value, I just want to set a value for the variable and then run the job specifying '$ENV' as the parameter value. I have tried setting the variable using the UNIX command line ('OutputFilePath=/project4/dsadm') but the value of the parameter shows up blank when I run the job specifying '$ENV'. The same thing happens when I open up Datastage Administrator, go to the 'Environment' page of my project and set this variable there.

Posted: Mon Sep 29, 2003 4:39 am
by Eric
Set your variable in your job to $ENV and re-compile

From a unix prompt ...

set your variable in your shell.
cd to the project directory
use /dsjob -run -local

[:)]

Posted: Tue Sep 30, 2003 4:54 pm
by ray.wurlod
If you're running Bourne shell, you will need to export the environment variable.
To find out what shell you're using, echo $SHELL
To set and export the environment variable, set its value then use the export command.
ENV=New value for this variable
export ENV

Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518

Posted: Tue Sep 30, 2003 4:55 pm
by ray.wurlod
quote:Originally posted by Ray.Wurlod
[br]If you're running Bourne shell, you will need to export the environment variable.
To find out what shell you're using, echo $SHELL - the Bourne shell returns /bin/sh
To set and export the environment variable, set its value then use the export command.
ENV=New value for this variable
export ENV

Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518


Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518