Environment Variables

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
Thanh Dalton
Premium Member
Premium Member
Posts: 57
Joined: Wed Nov 15, 2006 10:25 am
Location: Ottawa ON

Environment Variables

Post by Thanh Dalton »

Hi all,

I have read all I could about the evironment variables on this forum.

I created a user-defined environment variable under administrator as $Server_NAME.

In my Job Properties, I add environment variable $Server_NAME under Parameters. In the default value, I could see the value that I put in by Administrator.

I put #$Server_NAME# in the Server Name of the DB2 stage.
I compiled and ran the job and got the error below. I tried to change the default value as $PROJDEF for $Server_NAME under Parameters. I compiled and ran the job again and still got the same error below.

DB2_UDB_API_0,0: Fatal Error: Fatal: [IBM][CLI Driver] CLI0124E Invalid argument value. SQLSTATE=HY009
DSTAGE-DB2CLI-0005`:`Unable to connect to DB2 server 'NOTLIKELYDSCAPIOP_$Server_NAMENOTLIKELY'.

Any advice? Please help!
Thanks
TD
TPQ
throbinson
Charter Member
Charter Member
Posts: 299
Joined: Wed Nov 13, 2002 5:38 pm
Location: USA

Post by throbinson »

Do a search on DSCAPIOP.

Looks like the DB2 Stage cannot resolve the Environment variable.

There should be a patch. Request it.
lstsaur
Participant
Posts: 1139
Joined: Thu Oct 21, 2004 9:59 pm

Post by lstsaur »

TD,
Has the connection between DB2 client and DB2 server been configured?
All necessary entries for DB2 been populated in dsenv? Have you tested the DB2 connection from the command line?
rleishman
Premium Member
Premium Member
Posts: 252
Joined: Mon Sep 19, 2005 10:28 pm
Location: Melbourne, Australia
Contact:

Post by rleishman »

Instead of running the job, try View Data from the DB2 stage in the designer window.

There is a bug in the Dynamic RDBMS stage (at least in v8) whereby it DOES recognise environment variables when you View Data, but does NOT when you run the job.

Possibly the same bug exists in the DB2 stage
Ross Leishman
Thanh Dalton
Premium Member
Premium Member
Posts: 57
Joined: Wed Nov 15, 2006 10:25 am
Location: Ottawa ON

Post by Thanh Dalton »

Thanks to all for your advice.

I have tried to hard code the values and I got the DB2 connection works fine. I tried to use GetEnvironment variable and I did get it. But as soon as I want to apply to the DB2 stage and I got the problem.

I have read so much on this forum about this problem. Someone said he had the same problem and solved it by dsenv. He didn't say in details on it.

I don't know what it is. Can anybody tell me what it is and how to solve the problem with this???

Thank you so much in advance!
TPQ
TPQ
richdhan
Premium Member
Premium Member
Posts: 364
Joined: Thu Feb 12, 2004 12:24 am

Post by richdhan »

Hi,

Are you using the DB2 Enterprise Stage or DB2 API stage?

Try connecting to DB2 using these 2 stages.

Dont use the environment variable for now.

Just create a job parameter say server and try to use the parameter.

I have had the same issue with Teradata Multiload stage. It does not accept parameters which are defined as environment variables.

HTH
--Rich
craviraj
Participant
Posts: 17
Joined: Mon Jun 12, 2006 5:17 am
Location: Secunderabad

Environment Variables

Post by craviraj »

Sometimes connecting using ODBC stage solves the problem. There were instances where we could not connect to DB2 using DB2 stages, but were able to connect using ODBC stage.
-----------------------
R-Square
[Ravi Raj]
Thanh Dalton
Premium Member
Premium Member
Posts: 57
Joined: Wed Nov 15, 2006 10:25 am
Location: Ottawa ON

Re: Environment Variables

Post by Thanh Dalton »

I use DB2 API stage and when I clicked on the Review Data button, I got the result correctly from the SQL that I wrote. But when I ran the job, the DB2 stage didn't recognize the environment variable.

I tried with ODBC but it didn't work with the environment variable. I worked with the Server Name that I clicked from the DataSource button.

I need to set up the environment variables which we could use with multi environments later for our system.
Thanks,
TPQ
TPQ
richdhan
Premium Member
Premium Member
Posts: 364
Joined: Thu Feb 12, 2004 12:24 am

Post by richdhan »

Hi TPQ,

As I mentioned earlier do not use the job parameter which you picked from the environment variables list ($Server_Name) to be used in the DB2 API stage.

Create a parameter which is unique to the job say Server_NAME.

Create a job sequence and add the environment variable $Server_Name in the job parameter list. Add the parallel job as a job activity in the sequence. In the job activity parameter list map $Server_Name to Server_Name.

This should solve your problem.

--Rich
Thanh Dalton
Premium Member
Premium Member
Posts: 57
Joined: Wed Nov 15, 2006 10:25 am
Location: Ottawa ON

Post by Thanh Dalton »

Thanks a million, Rich!

I got it worked.
TPQ
TPQ
Post Reply