Parameter Set's value in Unix shell script

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
brupun
Premium Member
Premium Member
Posts: 16
Joined: Thu Jun 14, 2012 10:10 am

Parameter Set's value in Unix shell script

Post 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?
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post 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
brupun
Premium Member
Premium Member
Posts: 16
Joined: Thu Jun 14, 2012 10:10 am

Post by brupun »

Thanks for responding. How do I retrieve the value from DSParams in shell script? I'm not familliar with that.
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post by Mike »

It's just a text file... use whatever scripting technique you're familiar with (e.g. grep/cut).

Mike
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post 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
brupun
Premium Member
Premium Member
Posts: 16
Joined: Thu Jun 14, 2012 10:10 am

Post 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.
bhasds
Participant
Posts: 79
Joined: Thu May 27, 2010 1:49 am

Post 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.
brupun
Premium Member
Premium Member
Posts: 16
Joined: Thu Jun 14, 2012 10:10 am

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