Page 1 of 1

Environment Variable not working

Posted: Fri Jul 08, 2005 3:10 pm
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

Posted: Fri Jul 08, 2005 3:21 pm
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

Posted: Fri Jul 08, 2005 3:25 pm
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

Posted: Fri Jul 08, 2005 3:37 pm
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

Posted: Fri Jul 08, 2005 3:41 pm
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

Posted: Fri Jul 08, 2005 4:12 pm
by amsh76
Why can't you keep it like following:

#$A#\#$B#\#$C#....whats wrong in this? This takes care of your problem.

Posted: Sat Jul 09, 2005 5:51 am
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.

Posted: Sat Jul 09, 2005 6:39 am
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

Posted: Mon Jul 11, 2005 8:52 am
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

Posted: Mon Jul 11, 2005 10:08 am
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