Page 1 of 1

get user defined environment variable in job sequence

Posted: Sun Jul 06, 2008 5:56 am
by madhukar
Hi All,

I need to fetch the value of user defined environment variable in job sequence based on an input parameter to sequence.

I am looking for a similar function like GetEnvironment() in parallel transformer.

Regards,
Madhukar

Posted: Sun Jul 06, 2008 6:39 am
by chulett
You could capture it using an Execute Command stage and 'echo'. Or add it as a job parameter to the sequence and set it to $PROJDEF. Depends on what 'based on an input parameter' means. :?

Posted: Sun Jul 06, 2008 7:23 am
by madhukar
input parameter to sequence name will be a database name.
Based on database name i need to fetch the username and pwd which is set as used defined environment variable

Posted: Sun Jul 06, 2008 9:12 am
by chulett
And how do you plan on doing that? Meaning, how will the database name tell you which username and pwd environment variable to get?

Posted: Sun Jul 06, 2008 9:46 am
by chulett
Let me make an assumption here that the db name is part of the variable name. Put the pieces together and 'echo' the result:

Code: Select all

echo $#P_DB_NAME#_USER
echo $#P_DB_NAME#_PWD
Two Execute Command stages or a custom routine called in two Routine Activity stages. I'd probably prefer the latter as you have more control over the string building and error handling, plus you can strip any extra who-ha (like Field Marks) from the result before passing it back. Either way could be made to work, however.

Posted: Sun Jul 06, 2008 10:18 am
by madhukar
yes, I implemented with echo $DB_USER $DB_PWD $DB_SERVER. But i have problems with pwd variable which is of type encrypted.

Any suggestions in this regard?

Posted: Sun Jul 06, 2008 5:35 pm
by chulett
What kind of problems? I doubt you'll be able to use encrypted values with a technique like this.

Posted: Sun Jul 06, 2008 6:14 pm
by ray.wurlod
If the parameter is a parameter of the job sequence itself, then you can simply use it directly to supply the parameter value in any Job activity. Just use the "insert parameter value" tool. Encrypted or not, it will work.

Posted: Sun Jul 06, 2008 7:09 pm
by chulett
It's not.

Posted: Sun Jul 06, 2008 9:22 pm
by ray.wurlod
But it could be. The job sequence itself could have a parent sequence. However, encrypted parameters are still an issue - can you use $ENV to pick these up?

Posted: Mon Jul 07, 2008 1:34 pm
by madhukar
$ENV didn't work.
How can assign the value of environment variable to a job parameter from command line
e.g.
DBPWD -- job parameter
$DBPWD -- environment variable

how can i assign DBPWD with the value of $DBPWD (DBPWD=$DBPWD)

regards,
Madhukar

Posted: Mon Jul 07, 2008 3:12 pm
by ray.wurlod
You don't. You make $DBPWD itself the job parameter.