Setting value of User Defined 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
parag.s.27
Participant
Posts: 221
Joined: Fri Feb 17, 2006 3:38 am
Location: India
Contact:

Setting value of User Defined Environment Variable

Post by parag.s.27 »

Hi,

I have a situation where i need to use environment variable value in a sequence of jobs.

I wanted to know that, is there any way in which i can set the environment variable value in any stage for example in Transformer.

I tried to do it by passing Stage Variable value directly to a User Defined Environment variable but it did'nt work.

Kindly suggest
Thanks & Regards
Parag Saundattikar
Certified for Infosphere DataStage v8.0
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Parag,

you can set the UNIX or WINDOWS environment variables in a transform stage but the changes are only going to be visible inside that transform and in no other places. This is because actions are performed by different processes that run independantly of each other. The only common environment variable values will be those inhereted from the original calling process.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

From your post, i guess your requirment would be to set a envirnment variable to particual job or to a series of job based on a conditon.
If that is a case, you can use 'UserVariableActivity'.
Built for the same reason.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Post by I_Server_Whale »


I tried to do it by passing Stage Variable value directly to a User Defined Environment variable but it did'nt work.
What did you try? Or how did you try? Please let us know.

If I remember correctly, you can call a environment variable in your stages like this way:

Code: Select all


#$ENV_VARIABLE#

Thanks,
Naveen.
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
parag.s.27
Participant
Posts: 221
Joined: Fri Feb 17, 2006 3:38 am
Location: India
Contact:

Post by parag.s.27 »

naveendronavalli wrote:

I tried to do it by passing Stage Variable value directly to a User Defined Environment variable but it did'nt work.
What did you try? Or how did you try? Please let us know.

If I remember correctly, you can call a environment variable in your stages like this way:

Code: Select all


#$ENV_VARIABLE#

Thanks,
Naveen.

Hi,

I think in Transformer we don't need to include # with the environment variable.

I wrote: $enFileName = DSLink.instance

here instance is a source file column from where i need to pickup certain data, and on the basis of this data i need to create different files automatically.

for example if data in "instance" is 812 then environment variable is set and then in the next stage in sequence another job must check the environment variable value and based on this certain transformations are to be applied.
Thanks & Regards
Parag Saundattikar
Certified for Infosphere DataStage v8.0
parag.s.27
Participant
Posts: 221
Joined: Fri Feb 17, 2006 3:38 am
Location: India
Contact:

Post by parag.s.27 »

kumar_s wrote:From your post, i guess your requirment would be to set a envirnment variable to particual job or to a series of job based on a conditon.
If that is a case, you can use 'UserVariableActivity'.
Built for the same reason.
Hi Kumar,

I am already using UserVariableActivity.

But for that i need to predefine those values in that stage. but my requirement is to check the incomming data from a source column and then set an environment variable value. and later use that value to check & perform certain transformations on data in the later stages
Thanks & Regards
Parag Saundattikar
Certified for Infosphere DataStage v8.0
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Does it have to be an environment variable? Can you use a system variable (such as @USER0), or the job's user status area?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
parag.s.27
Participant
Posts: 221
Joined: Fri Feb 17, 2006 3:38 am
Location: India
Contact:

Post by parag.s.27 »

ray.wurlod wrote:Does it have to be an environment variable? Can you use a system variable (such as @USER0), or the job's user status area? ...
Hi Ray,

Actually i was not sure whether a system variable value is accessible across multiple jobs in a sequence.

But i thought that if i can set environment variable then it can be accessible across multiple jobs.
Thanks & Regards
Parag Saundattikar
Certified for Infosphere DataStage v8.0
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Alas, the environment variable changed value is not inherited by the parent process (the job's controlling job sequence), so that approach fails. So does the approach using system variables, for a similar reasons; the jobs run in different processes from the job sequence.

However, the job sequence can pick up a value set in one job's user status area and pass it to another job as a parameter. Such an approach may work for you.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
parag.s.27
Participant
Posts: 221
Joined: Fri Feb 17, 2006 3:38 am
Location: India
Contact:

Post by parag.s.27 »

ray.wurlod wrote:Alas, the environment variable changed value is not inherited by the parent process (the job's controlling job sequence), so that approach fails. So does the approach using system variables, for a si ...
Hi Ray,

I was not able to see the entire content of your reply probably because you are a premium member.

Actually in my job i need to provide a default value to the environment variable at the starting of the sequence by passing the default value through a parameter in a UserVariableActivity.

but i don't know how can i supply system variable as a parameter at the starting of the sequence.

how can i define my own system variables
can you please help
Thanks & Regards
Parag Saundattikar
Certified for Infosphere DataStage v8.0
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Hmm.... His point is... If you change the Environmental Variable at the mid of the execution of a sequence, the chaged value wont be reflected to the main job control, and hence wont refelect to the upcomming called jobs.
So you need to use some of the conventional methond of passing values among jobs.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Post Reply