Page 1 of 1

Parameter Set's value in Unix shell script

Posted: Thu Nov 15, 2012 9:39 am
by brupun
Hi,

I'm executing a SQL statement in Unix shell script, which in turn calls a Datastage job. I want to connect to Db2 using login field values from Parameter set's environment variables. These environment variables have default value as $PROJDEF. I want to capture their value stored in a specific value file. Is it possible to extract these values in Unix shell script?

Posted: Thu Nov 15, 2012 12:35 pm
by Mike
Sure, it can be done.

Since you are dealing with $PROJDEF, you'll have to retrieve the value from DSParams. Note that if the type is encrypted string (typical for database passwords), you will have to find a method to decrypt the string.

Mike

Posted: Thu Nov 15, 2012 1:09 pm
by brupun
Thanks for responding. How do I retrieve the value from DSParams in shell script? I'm not familliar with that.

Posted: Thu Nov 15, 2012 1:20 pm
by Mike
It's just a text file... use whatever scripting technique you're familiar with (e.g. grep/cut).

Mike

Posted: Thu Nov 15, 2012 1:24 pm
by Mike
Almost forgot...

There's also a nice little command available (forget which version it first appeared).

Code: Select all

dsadmin -listenv MYPROJECT
Mike

Posted: Thu Nov 15, 2012 2:01 pm
by brupun
I did use this command to get other field values. Now, the challenge lies in decrypting password field values. Thanks a lot for your help.

Posted: Thu Nov 15, 2012 10:22 pm
by bhasds
Hi brupun,

For decrypting the password field values-
Use echo #Parametername# in before or after job subroutine.
The value will be reflecting in the Director log.

Posted: Tue Dec 04, 2012 12:18 pm
by brupun
Hi bhasds,

The value displayed in the log is encrypted value for password. My requirement is that I need to use the password from environment variable and use it to connect to Db2 database in my shell script. You have any thoughts on how to achieve that?