Page 1 of 1

materializing environment variables in a datastage job

Posted: Mon Sep 29, 2008 8:46 am
by DSH
Hi, Is there a way to materialize environment variables (those variables defined in administrator for a project ) in a transformation stage? I see the ability to materialize local variables. I'm looking to place the value of these variables as actual data in a sequential file.

I'm not really set on using a transformation stage if there is some other way to do this. Example would be a environment variable with the database name in it.

thanks!

Posted: Mon Sep 29, 2008 9:21 am
by ArndW
I'm not at a workstation where I can test this now, but if you cannot use the user-defined variables directly, then you declare them as part of your job parameters, call them with a value of "$PROJDEF" and use them in the transform stage.

Posted: Mon Sep 29, 2008 9:47 am
by DSH
Thanks for the response.. Yes, that is what I was trying. Including them as a job parameter, for example Job parameter $env with a default value of $PROJDEF. Then I'm trying to use $env in the transform.. that is where I'm not able to materialize to the actual value. Thanks.

Posted: Mon Sep 29, 2008 9:57 am
by chulett
You need to have created them in the project via the Administrator first, did you do so? If you did, you'd need to expand a teeny bit on the problem you are having. Saying "not able to materialize" doesn't really give us much to go on.

Posted: Mon Sep 29, 2008 11:49 am
by pneumalin
I believe you are looking for function: GetEnvironment, because you cannot use Environment Variables directly in a transformer like the job parameter. You have to call the function to return the value for you.

Posted: Mon Sep 29, 2008 4:37 pm
by DSH
Thank you.. I will look into that when I get back to the office tomorrow morning!

Posted: Mon Sep 29, 2008 4:57 pm
by chulett
You can if they are defined in the project and then passed in as job parameters. You would need to use the function noted for environment variables not defined / passed in.