Environment Variable not working

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
dscnn
Participant
Posts: 26
Joined: Tue May 17, 2005 1:11 pm

Environment Variable not working

Post by dscnn »

I am defining a few env variables in DS Administrator as

A = valA
B=valB
C=valC
D=$A\$B\$C

I am declaring the variables in my job

and using D in my Sequential Stage to give me the directory path, but I am getting an error that its not abe to create the file. I have verified that the directories exist.
I have tried with $D , #$D# and have tried defining it in the JOB as $PROJDEF but it still keeps giving me the same error

All Help appreciated
Last edited by dscnn on Fri Jul 08, 2005 3:26 pm, edited 1 time in total.
pnchowdary
Participant
Posts: 232
Joined: Sat May 07, 2005 2:49 pm
Location: USA

Post by pnchowdary »

Hi,

Have you included the Environment Variables that you want to use in the job, in the parameters tab of the Job Properties?

If not, you can insert the Environment Variables that you defined using adminstrator, by clicking on Add Environment Variable button on the bottom right and picking the variable you want to use from the popup list.

When referring to the global environment variables in your job, use #$SOURCE#

I guess that should solve your problem.

Thanks,
Naveen
dscnn
Participant
Posts: 26
Joined: Tue May 17, 2005 1:11 pm

Post by dscnn »

Hi Naveen,

I have included the Environment variables on the Job Parameter Listing.

When I use the Env variables individually in my Sequential Stage like
#$A#\#$B#\#$C# it works OK

I have updated my initial Query to reflect the situation accurately

pnchowdary wrote:Hi,

Have you included the Environment Variables that you want to use in the job, in the parameters tab of the Job Properties?

If not, you can insert the Environment Variables that you defined using adminstrator, by clicking on Add Environment Variable button on the bottom right and picking the variable you want to use from the popup list.

When referring to the global environment variables in your job, use #$SOURCE#

I guess that should solve your problem.

Thanks,
Naveen
pnchowdary
Participant
Posts: 232
Joined: Sat May 07, 2005 2:49 pm
Location: USA

Post by pnchowdary »

Hi,

Try declaring D=valA\valB\valC instead of D=$A\$B\$C in your Datastage Administrator.

Thats should take care of your problem.

Thanks,
Naveen
dscnn
Participant
Posts: 26
Joined: Tue May 17, 2005 1:11 pm

Post by dscnn »

Hi,

We are trying to incorporate 'extreme' flexibility. If $A or $B changes, we don;t want to go and change the other variable values unless its major, $D in this case, which may be multiple

Would appreciate if someone can tell how to use an value of an environment variable inside another environment variable itself, or simply, just give a solution of the initial query.
pnchowdary wrote:Hi,

Try declaring D=valA\valB\valC instead of D=$A\$B\$C in your Datastage Administrator.

Thats should take care of your problem.

Thanks,
Naveen
amsh76
Charter Member
Charter Member
Posts: 118
Joined: Wed Mar 10, 2004 10:58 pm

Post by amsh76 »

Why can't you keep it like following:

#$A#\#$B#\#$C#....whats wrong in this? This takes care of your problem.
dscnn
Participant
Posts: 26
Joined: Tue May 17, 2005 1:11 pm

Post by dscnn »

Our directotry structures can change a lot. We are using $D as the paths in out Sequential Stage and are trying to fill D in DS Administrator itself, by using othe env variables as decribed above. We don't want to change the jobs if the structure changes each time.

Although I haven't tried D=#$A#\#$B#\#$C# in my DS Administrator, which I'll do Monday morning.

In short, I am really looking for a way to use the values of env variables in other env variables themselves.
amsh76 wrote:Why can't you keep it like following:

#$A#\#$B#\#$C#....whats wrong in this? This takes care of your problem.
elavenil
Premium Member
Premium Member
Posts: 467
Joined: Thu Jan 31, 2002 10:20 pm
Location: Singapore

Post by elavenil »

We are exactly doing as mentioned in the post but not as environment variables as parameters. #$A#\#$B#\#$C should work. This would give a problem, if your OS gets changed from windows to UNIX. So i would suggest you to have another variable to store directory separator so that you do not need to change the job even if your OS changed.

HTWH.

Regards
Saravanan
dscnn
Participant
Posts: 26
Joined: Tue May 17, 2005 1:11 pm

Post by dscnn »

Hi Saravanan,

I am trying to use #$D# directly in my Sequential Stage instead of #$A#\#$B#\#$C#
and D = $A\$B\$C in DS Administrator is being defined.

I really need help on this fast, or atleast someone to tell me that it cannot work this way.
If it works a step by step approach will be great to know.
elavenil wrote:We are exactly doing as mentioned in the post but not as environment variables as parameters. #$A#\#$B#\#$C should work. This would give a problem, if your OS gets changed from windows to UNIX. So i would suggest you to have another variable to store directory separator so that you do not need to change the job even if your OS changed.

HTWH.

Regards
Saravanan
elavenil
Premium Member
Premium Member
Posts: 467
Joined: Thu Jan 31, 2002 10:20 pm
Location: Singapore

Post by elavenil »

I think D is expecting only a value rather than the parameters. Let me try few options and i will let you know.

Regards
Saravanan
Post Reply