$ENV parameter value

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
manavkumarm
Participant
Posts: 11
Joined: Fri Sep 05, 2003 3:45 am
Location: India

$ENV parameter value

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

Post 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
manavkumarm
Participant
Posts: 11
Joined: Fri Sep 05, 2003 3:45 am
Location: India

Post 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?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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
manavkumarm
Participant
Posts: 11
Joined: Fri Sep 05, 2003 3:45 am
Location: India

Post 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.
Eric
Participant
Posts: 254
Joined: Mon Sep 29, 2003 4:35 am

Post 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

[:)]
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

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

Post 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
Post Reply