get user defined environment variable in job sequence

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
madhukar
Participant
Posts: 86
Joined: Fri May 20, 2005 4:05 pm

get user defined environment variable in job sequence

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
madhukar
Participant
Posts: 86
Joined: Fri May 20, 2005 4:05 pm

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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?
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
madhukar
Participant
Posts: 86
Joined: Fri May 20, 2005 4:05 pm

Post 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?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

What kind of problems? I doubt you'll be able to use encrypted values with a technique like this.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

It's not.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
madhukar
Participant
Posts: 86
Joined: Fri May 20, 2005 4:05 pm

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You don't. You make $DBPWD itself the job parameter.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply