environment variable doubt

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
rishabh
Participant
Posts: 24
Joined: Mon Apr 10, 2006 11:40 pm

environment variable doubt

Post by rishabh »

Hi everyone,

I am using DS server edition 7.5.1 with DB2 running on unix server.

I want to set the environment variable value in one of the jobs as a result of some intermediate calculations. This new value must be used in all the other jobs as the environment variable.

Can this be done and if yes what is the procedure to achieve the same.
Thanks in advance
dprasanth
Charter Member
Charter Member
Posts: 90
Joined: Fri Oct 07, 2005 7:55 am

Re: environment variable doubt

Post by dprasanth »

rishabh wrote:Hi everyone,

I am using DS server edition 7.5.1 with DB2 running on unix server.

I want to set the environment variable value in one of the jobs as a result of some intermediate calculations. This new value must be used in all the other jobs as the environment variable.

Can this be done and if yes what is the procedure to achieve the same.
Thanks in advance
One way of doing it is defining the variable at PROJECT level in ds administrator.
Login to adminstrator , click on the project you want and then properties.
In the bottom you will see enviornment. Click on that and you will see userdefined variables. Define your environment variables there and you can see it in all the jobs in that project.
Say you want to define a SHELL
You will just say SHELL and the value as /bin/ksh.
evanmaas
Charter Member
Charter Member
Posts: 60
Joined: Tue Apr 22, 2003 5:19 am
Location: Belgium

Post by evanmaas »

HI,

This solution only works for sequence.
You can use the DSSetUserStatus to put the value of your result in a job or routine. Use <jobname>/<routinename>.$Returnvalue as value expression in other Job activity/routine activity.

Regards,

Erik
rishabh
Participant
Posts: 24
Joined: Mon Apr 10, 2006 11:40 pm

Post by rishabh »

thanks for the prompt replies..

Let me clarify my exact requirements.
I define an environment variable say VarTry in the administartor with value as say 'abc'

I want to override it in a job X with VarTry being set to 'xyz'
Can this be done?
Also now i want all the subsequent jobs to use VarTry with the new value 'xyz' and not the original value 'abc'.

I tried putting the environment varible VarTry as a stage varibale in the transformer and to reset it to 'xyz'.However this does not change VarTry value in Job Y.

Thanks :)
evanmaas
Charter Member
Charter Member
Posts: 60
Joined: Tue Apr 22, 2003 5:19 am
Location: Belgium

Post by evanmaas »

rishabh wrote:thanks for the prompt replies..

Let me clarify my exact requirements.
I define an environment variable say VarTry in the administartor with value as say 'abc'

I want to override it in a job X with VarTry being set to 'xyz'
Can this be done?
Also now i want all the subsequent jobs to use VarTry with the new value 'xyz' and not the original value 'abc'.

I tried putting the environment varible VarTry as a stage varibale in the transformer and to reset it to 'xyz'.However this does not change VarTry value in Job Y.

Thanks :)

Environment variables you can't override or change in processes only in DS administrator. Use of environment parameters is never change in the project and you want changes parameters. Why don't you use job parameters? My earlier suggestion works for jobparameters,

Regards,

Erik
rishabh
Participant
Posts: 24
Joined: Mon Apr 10, 2006 11:40 pm

Post by rishabh »

ya erik i understand what u have suggested..

Can you please tell me what can be used at the job level,which when once set can be used for all the other jobs which follow.

Something like a global variable in Data stage which is set in a job and then used throughout.

Thanks
evanmaas
Charter Member
Charter Member
Posts: 60
Joined: Tue Apr 22, 2003 5:19 am
Location: Belgium

Post by evanmaas »

Steps to follow:
Important is use of jobsequence because you have dependency.

1 fill the userstatus of the job with calculated value (dssetuserstatus) in job1
2 In job activity of jobsequece of job2 you use job1.$Returnvalue as value expression for parameter calc_par.
3 job2 will run with value of returnstatus of job1

I've done this several times

Erik
Post Reply