Environment variables in Parallel jobs

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
sairamkrish
Participant
Posts: 100
Joined: Wed Feb 02, 2005 4:02 am

Environment variables in Parallel jobs

Post by sairamkrish »

Hi,

Have a job which extracts records from db2 tables on mainframes using Db2 API stage and loads into a txt file.The DSN/UserId/Pwd are parameterised as environment variable in the Db2 API stage. Job aborts when run with the following message.

f,0: Fatal Error: Fatal: [IBM][CLI Driver] CLI0124E Invalid argument value. SQLSTATE=HY009
Unable to connect to DB2 server '#DSCAPIOP__DSN#'.

It is clearly evident that the parameters are not taken when declared as environment variable. Also the sqlstate=HY009 corresponds to null arguments in SQLBindParameter() function.The same job works fine when the DSN/UserId/Pwd are declared as job parameter variables.

Would like to know how to use environment variable in Parallel jobs.

Thanks
Krishna
ashwin141
Participant
Posts: 95
Joined: Wed Aug 24, 2005 2:26 am
Location: London, UK

Environment variables in Parallel jobs

Post by ashwin141 »

Are you specifying the schema name with the table name?
Did you check for APT_DBNAME?
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Add $DSCAPIOP__DSN in your job properties.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
sairamkrish
Participant
Posts: 100
Joined: Wed Feb 02, 2005 4:02 am

Post by sairamkrish »

kumar_s wrote:Add $DSCAPIOP__DSN in your job properties.
Hi,

How do i add that $DSCAPIOP__DSN to job properties?. I dont find that in the list of Environment variables.

Thanks
Krishna
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

May I know what is the version of DS you use. If you go to Job properties under parameters tab, you can find 'Add Enviromental variable' button. If you click on it you can find list of all available environmental variables. You can go to the last part, User Defined. And select the variable you have defined there. (Make sure you have defined in the Adminstrator client prior to this).
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
sairamkrish
Participant
Posts: 100
Joined: Wed Feb 02, 2005 4:02 am

Post by sairamkrish »

kumar_s wrote:May I know what is the version of DS you use. If you go to Job properties under parameters tab, you can find 'Add Enviromental variable' button. If you click on it you can find list of all available environmental variables. You can go to the last part, User Defined. And select the variable you have defined there. (Make sure you have defined in the Adminstrator client prior to this).
Hi,

Version is DS 7.5.2.Can u tel me why this variable #DSCAPIOP__DSN# needs to be added in job properties. I already have environment variables for DSN/USER/PWD set in in administrator.

Thanks
Krishna
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

This is to set the environmetal variable at run time.
If you need to use the existing variable, you may include $ENV or $PROJDEF in you Job property.
$ENV will Instructs DataStage to use the current setting for the environment variable.
$PROJDEF - Will reflect the change in the value even after compilation or runtime.
Search on this term you may find lot of post. Also look into FAQ forum you may find a post witten by Vincent.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
sairamkrish
Participant
Posts: 100
Joined: Wed Feb 02, 2005 4:02 am

Post by sairamkrish »

kumar_s wrote:This is to set the environmetal variable at run time.
If you need to use the existing variable, you may include $ENV or $PROJDEF in you Job property.
$ENV will Instructs DataStage to use the current setting for the environment variable.
$PROJDEF - Will reflect the change in the value even after compilation or runtime.
Search on this term you may find lot of post. Also look into FAQ forum you may find a post witten by Vincent.
Am using $PROJDEF for all the three environment variable $DSN,$USR and $ PWD.. but i get the same error as above.

Thanks
Krishna
Post Reply