Page 1 of 2

Environment variables

Posted: Tue Jan 22, 2008 2:56 pm
by jseclen
Hi Forum,

In my server exists 2 projects, Desarrollo y Certificacion, and each project access to different oracle database. I set in my jobs the environment variables for each project with diferents values, but, when i open the job in Desarrollo shown the rigth values configured for this project, and when i open the job in the Certificacion show the same values!!!

The variables for each projects are: (was settings with Administrator-->Environment)

Desarrollo
************
USER = U100
PASS = xxxx

Certificacion
*************
USER = U200
PASS = yyyy

why show the values of Desarrollo project when i open the certificacion job???

Thanks !!!

Re: Environment variables

Posted: Tue Jan 22, 2008 3:02 pm
by gateleys
You sure you did not hack into the same DSParams file? I guess so, isnce you have mentioned that you used the Admin client. This is weird.
jseclen wrote: why show the values of Desarrollo project when i open the certificacion job???
What happens when you open the Desarrollo project? Is it that the values for Desarrollo project being shown in both projects, or are they interchanged?

Try leaving some variable values in the Certificacion project as empty, and check what happens?

Re: Environment variables

Posted: Tue Jan 22, 2008 3:18 pm
by jseclen
Hi gateleys

I change the values for empty in Certificacion project user variables, and open my job, view the odbc stage and show me the Desarrollo values again.

Is necessary restart the services to take the last changes????

Thanks.

Re: Environment variables

Posted: Tue Jan 22, 2008 4:01 pm
by gateleys
jseclen wrote:Hi gateleys

I change the values for empty in Certificacion project user variables, and open my job, view the odbc stage and show me the Desarrollo values again.

Is necessary restart the services to take the last changes????

Thanks.
For some reason, it seems that your env variables are being written to the same DSParams file? Can you check the DSParams file for hte Certificacion project and scroll down to the check for the values?

Posted: Tue Jan 22, 2008 6:24 pm
by ray.wurlod
I don't think that's right, because changing to "" in Administrator had no effect.

Are you clicking Cancel (rather than OK) to close the Administrator windows?

It is not necessary to re-start services, but it might be interesting to open a new Administrator client after making these changes.

Posted: Tue Jan 22, 2008 9:01 pm
by Teej
Are you hard-coding the values in the jobs itself?

Are those environment variables set in dsenv?

Posted: Wed Jan 23, 2008 10:23 am
by jseclen
Hi Ray, thanks for your help, but dont work, i changed the variables in Desarrollo and close the window. open another administrator and set new values for certificacion, and press Ok button ...

In the manager open the job from the Desarrollo and Certificacion projects, but is the same result ... show me the values of desarrollo

Posted: Wed Jan 23, 2008 10:40 am
by jseclen
Hi Teej,

In my job i'm setting job parameters and load this environment variables to the grid. There aren't hardcore values in the job.

And, this environment variables are news and doesnt exist in the dsenv file

Posted: Wed Jan 23, 2008 10:45 am
by gateleys
Did you check the values for the concerned variables in DSParams file of each project?

Posted: Wed Jan 23, 2008 11:36 am
by jseclen
Hi gateleys,

Both files contains the values defined in this administrator window for each one, in desarrollo and certificacion are differents.

DSParams from Desarrollo
[EnvVarValues]
"XCP_DB"\1\"XCPDWX_odbc"
"XCP_USER"\1\"IU231275"
"XCP_PASS"\1\"LD:@09VDM4K"

DSParams from Certificacion
[EnvVarValues]
"XCP_BD"\1\" ertertert"
"XCP_USER"\1\"ertertertert"
"XCP_PASS"\1\"LDH@9HVH=9;L0O4I4:"

Now, what is the next step???? :shock:

p.d. when i was changing the text value and double-click appear a new window that permit to set this text as $ENV or $UNSET, what is the funcionality for this?

Posted: Wed Jan 23, 2008 12:51 pm
by gateleys
jseclen wrote: p.d. when i was changing the text value and double-click appear a new window that permit to set this text as $ENV or $UNSET, what is the funcionality for this?
OK, in the job parameter window, set each of those variables to $PROJDEF. Now, see if it points to the right parameter value.

$PROJDEF would assign the value that you defined in the User Variables grid in Administrator.

Posted: Wed Jan 23, 2008 12:59 pm
by chulett
$ENV tells DataStage to use the current value defined in the environment.
$UNSET tells it to unset/remove that variable from the environment if it is defined there.

Posted: Wed Jan 23, 2008 2:44 pm
by jseclen
Ok now is working ... thanks.

I have a new question about that.

How create a job will use the values of Environment Variables in the job parameters????

For example:

Job1 in Desarrollo use the follow parameters and values
pXCP_DB = BASE1 (define in XCP_DB in Administrator)
pXCP_USER = u020 (define in XCP_USER in Administrator)
pXCP_PASS = xxx (define in XCP_PASS in Administrator)

my wish is when pass to Certificacion this job must be run using the values defined in the Environment Variables for this project, so, the default value may be take the value of environment at run??

Job1 must be use this values:

XCP_DB = BASE10
XCP_USER = u2000
XCP_PASS = yyy

is there a way to make this????

Posted: Wed Jan 23, 2008 2:50 pm
by gateleys
1. In your job properties, reference the 3 parameters by adding the environment variables.
2. For the values, double/triple click ... a dialog appears ... choose $PROJDEF.
3. In your job, wherever you are using the parameter, use the parameter name enclosed by #. For example: #$pXCP_DB#

Posted: Wed Jan 23, 2008 3:20 pm
by jseclen
gateleys,

Last time did not appear this value $PROJDEF only $ENV and $UNSET ... i change the default value with $PROJDEF, try to view the data and work ok !!!

I export the job to certificacion and try to view again and can see the data...

thanks !!!