Passing environmetal variable dynamically

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
kittu.raja
Premium Member
Premium Member
Posts: 175
Joined: Tue Oct 14, 2008 1:48 pm

Passing environmetal variable dynamically

Post by kittu.raja »

Hi,

I have a question on passing environmental variable dynamically (not values).

We are trying to create a common job, which has a common parameter $PASS. This is a multi-instance sequence, where we should get the passwords dynamically from lot other environment variables. We cannot include all the password environment variables in the job properties as there might be new variables added later.

We should use the new variables as required but without making any code changes. We can pass in the parameter to the job dynamically but I believe the sequence would abort if the variable is not defined in the job properties. Is there a way to get around this? Please share your thoughts.

Also note that I cannot have this value stored in a table or file and read it in the run time as these are passwords.

Your help is highly appreciated. Thanks in advance.
Rajesh Kumar
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post by jwiles »

One method would be to run your job using a sequencer. One (or more if appropriate) of the job parameters would be the name of the environment variable containing the password.

A command activity in the sequencer can echo the password: echo $#variable_name#, and the job activity can pass the output from the command activity as a job parameter to your job.

Of course you should encrypt your password if at all possible. The output from the command activity will show up in the job log.

There may be something that can be used within a BASIC routine as well, but can't think of it at the moment.

Regards
- james wiles


All generalizations are false, including this one - Mark Twain.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There is no limit to the number of parameters that a job may have.

When you add environment variable parameters to a job, you can use special tokens for their default values.
  • $PROJDEF means "use the default value defined for the project (in the Administrator client"

    $ENV means "obtain the value from the executing user's operating system environment (shell)"

    $UNSET means "treat this environment variable as unset unless a non-default value is provided when the job run request is issued"
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
karthi_gana
Premium Member
Premium Member
Posts: 729
Joined: Tue Apr 28, 2009 10:49 pm

Post by karthi_gana »

where i can find the list of token variables ? i mean in which manual?

i have recently faced an issue. I used environment variable for the password.

when i run the job , it failed with "Login Failed" error message.

I just checked with DSADMIN team and they edited the environment variable and entered $PROJDEF in both the text box. After that the job ran fine.

I really dont understand this. We used the same variable in almost 70 jobs. Do i need to do the above said exercise (like editing the environment variable and entering the $PROJDEF in both the text box) ? is there any way to achive this?

Also, going back to my previous question :)

where i can find the list of token variables ? i mean in which manual?
Karthik
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Token variables? If you mean ones like Ray listed, those three are it and you can find them in Client Guide for the Director or the Designer. If you mean all of the $APT environment variables, I don't recall seeing a manual where they are all listed but you can find them in any job's properties when you add an environment variable from the pick-list.
-craig

"You can never have too many knives" -- Logan Nine Fingers
karthi_gana
Premium Member
Premium Member
Posts: 729
Joined: Tue Apr 28, 2009 10:49 pm

Post by karthi_gana »

Thanks Craig !

any thoughts on my problem ? Do i need to apply $PROJDEF in all the jobs ?
Karthik
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Need to? No, it doesn't sound like it. I would imagine you simply entered the name of the variable incorrectly in that one job. Overall, the use of those tokens like $PROJDEF is certainly a best practice but you'd have to decide if it is worth the time and effort to change it across all jobs.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply