How to get Project's Environment variable.

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
Ravindar
Participant
Posts: 30
Joined: Tue Mar 23, 2004 6:14 am
Location: Chennai, India

How to get Project's Environment variable.

Post by Ravindar »

Hi all,

I want to get a list of Environment variable used in a project without using administrator.

Say I have enough access to go into that UV account. Then in what way can I get that list.

Thanks in advance.
dstechdev
Participant
Posts: 10
Joined: Thu May 27, 2004 6:54 am
Location: Plano, Texas

Post by dstechdev »

One way is to open the job properties of a job, click on Parameters then click on Add Environemnt Varaible in the lower right hand corner


John F.
ketfos
Participant
Posts: 562
Joined: Mon May 03, 2004 8:58 pm
Location: san francisco
Contact:

Post by ketfos »

Hi,
There is a file

dsenv

which sets up envirornmental variables for datastage.
By default it is set in dshome/DSEngine directory but can be in a different path. You can read this as seqential file in a datastage job and find out different environmental variables set like

DS_MMAPPATH=/tmp; export DS_MMAPPATH
DS_MMAPSIZE=32; export DS_MMAPSIZE
DS_MAXWRITEHEAPS=1; export DS_MAXWRITEHEAPS
ODBCINI=$dshome/.odbc.ini; export ODBCINI
HOME=${HOME:-/}; export HOME

#UDTHOME=$dshome/../ud41; export UDTHOME

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

Post by ray.wurlod »

Create a job that does anything (even just X = 0 in Job Control will suffice).
Create a before-job subroutine using ExecTCL to execute the ENV command.
The environment variables will appear in the job log.

If you have a recent enough version of DataStage, you don't even need to do this. Each time you run a server job, the first even logged is "starting job", the second event logged is "environment variable settings".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Ravindar
Participant
Posts: 30
Joined: Tue Mar 23, 2004 6:14 am
Location: Chennai, India

Slight change in my question.

Post by Ravindar »

sorry I want to be more specific that,

I need a list of "UserDefined Environmental variable" of a project from UV command prompt.

Thanks in Advance.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

ENV is a TCL-level command that displays all currently-set environment variables. You can also use its long form, ENVIRONMENT. On Windows it is equivalent to the DOS /C set command while on UNIX it is equivalent to the SH -c set command.

There is nothing in the operating system to distinguish whether an environment variable is "user defined" or otherwise, so there is no scope with this command for filtering just for these.

You could, of course, elect to use some form of naming convention for your user-defined environment variables, then filter the output somehow.

The ENV command can also be used to set and to unset environment variables.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Sreenivasulu
Premium Member
Premium Member
Posts: 892
Joined: Thu Oct 16, 2003 5:18 am

Post by Sreenivasulu »

You can add/View the enviormental variables from inside the lookup stages (doing a right click on the mapping box->Job Parameter-> Add envirornment variabl) inside the transformer.

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

Post by ray.wurlod »

The Lookup stage is for parallel jobs.
The original poster specified server jobs, and the desire to view the value of environment variables from the UV command prompt.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Ravindar
Participant
Posts: 30
Joined: Tue Mar 23, 2004 6:14 am
Location: Chennai, India

Post by Ravindar »

Hi,

The ENV command didn't show me the user defined EV which I created manually in my project.

In my case the purpose of user defined EV which I created is to parameterize the DB connection values.(Say I have created some 20 EV in adminstrator for my project and I used those variables as job parameters in my job.)

Now I need to get a list of such UserDefined EV in each of my project for documentation purpose.

Is there any way to get such list and store it in a file.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It's already stored in the DSParams file on the server (in the project directory). Why not parse from there? There is a separate section for user-defined environment variables, so you can easily capture them, perhaps using a BASIC routine.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kommven
Charter Member
Charter Member
Posts: 125
Joined: Mon Jul 12, 2004 12:37 pm

Post by kommven »

I believe there is a tool called "DataStage Environment Variable Transporter" for backing up and transferring Env. variables...
Post Reply