How to call environment variable in DB2-Stage

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
yollsonlegrand
Participant
Posts: 51
Joined: Fri Nov 07, 2008 8:03 pm

How to call environment variable in DB2-Stage

Post by yollsonlegrand »

Hello!!!
has some one allready setting up the environment variables in the Administrator and then call the Database globales Parameters into a DB2-Stage without problem?
Sequentiel file and all other stages work well with my environment variables calling in this Stage. Only DB2-stage did not work well. To contourn the proble I'm oblige to set "server-name", "Userid", and "Password"-Parameters als Job parameters to run the job correctly. What is not gut. Because thise parameters must be define als Global Parameters.
Any Ideas will be very Helpful.
Thank' once more fore haven been given back your Idea. After populate the Target table I will say you if all work other no.
Yollson Empereur
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Introduce the environment variables into your job as job parameters (or in a parameter set), then use job parameter references within your DB2 Enterprise stage or DB2 API stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
yollsonlegrand
Participant
Posts: 51
Joined: Fri Nov 07, 2008 8:03 pm

Post by yollsonlegrand »

ray.wurlod wrote:Introduce the environment variables into your job as job parameters (or in a parameter set), then use job parameter references within your DB2 Enterprise stage or DB2 API stage. ...
hello,
thanks for your Reply. Is there an other way to do this, differently from the way you advise it to me? Because, before calling in DB2-Stage or into ORACLE-Stage any parameters, this must be introduice in Job-Parameters tab of the Job Properties.
All my environment parameters are already introduice in this Job parameters. That is the reason this work well in other stage like Sequentiel file and so one.
The probleme is that, after seting up environment parameters(server_name, UserId, PWD) connexion to database in administrator and calling this in DB2-Stage like this: #$server_name#, #$UserId#, #$PWD# , runing the Job failed.
But by setting the same parameters als Job parameters and call this like this:#server_name#, #Userid#, #pwd# , runing the Job succeeded.
Perraph's I'm making some thingh wrong. But like I say. The same setting in Oracle_stage which failed down in DB2-stage, work very well. Is there an other way to do this fur DB2-Stage?
Yhank's for any Idea in advance.
Yollson Empereur
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

yollsonlegrand wrote:The probleme is that, after seting up environment parameters(server_name, UserId, PWD) connexion to database in administrator and calling this in DB2-Stage like this: #$server_name#, #$UserId#, #$PWD# , runing the Job failed.
Failed how?
-craig

"You can never have too many knives" -- Logan Nine Fingers
yollsonlegrand
Participant
Posts: 51
Joined: Fri Nov 07, 2008 8:03 pm

Post by yollsonlegrand »

chulett wrote:
yollsonlegrand wrote:The probleme is that, after seting up environment parameters(server_name, UserId, PWD) connexion to database in administrator and calling this in DB2-Stage like this: #$server_name#, #$UserId#, #$PWD# , runing the Job failed.
Failed how?
I receive the followed Message Error:'DSTAGE-DB2CLI-0005': Unable to connect to DB@ server ' NOTLIKELYDSCAPIOP_$PS_DBPTTSOURCENOTLIKELY'.,
by running the Job with following parameters: #$server_name#, #$UserId#, #$PWD#. But if I set the same parameters als Job parameters all work well.
And I did another test by setting all the other stage(Sequentiel file, Lookup Set file etc..) with the environment parameters and only the DB2-Stage with the local parameters(job parameters). the job work very well.

Thank's for any Ideas
Yollson Empereur
throbinson
Charter Member
Charter Member
Posts: 299
Joined: Wed Nov 13, 2002 5:38 pm
Location: USA

Post by throbinson »

You're SOL my friend. Those pesky IBM Developers didn't make environment variables work for all stages of a given job which limits the utility of environment variables for use in any DS job.
Bummer. Perhaps there is a DB2 patch?
The giveaway is seeing the DSCAPIOP_.

DataStage is not resolving this to a parameter value at runtime. It's not recognizing it as a parameter. We have the same problem with Teradata API stage. We're testing a patch.
yollsonlegrand
Participant
Posts: 51
Joined: Fri Nov 07, 2008 8:03 pm

Post by yollsonlegrand »

DataStage is not resolving this to a parameter value at runtime. It's not recognizing it as a parameter. We have the same problem with Teradata API stage. We're testing a patch.[/quote]

Thank's for this information.
Yollson Empereur
yollsonlegrand
Participant
Posts: 51
Joined: Fri Nov 07, 2008 8:03 pm

Post by yollsonlegrand »

DataStage is not resolving this to a parameter value at runtime. It's not recognizing it as a parameter. We have the same problem with Teradata API stage. We're testing a patch.[/quote]

Thank's for this information.
Yollson Empereur
arvind_ds
Participant
Posts: 428
Joined: Thu Aug 16, 2007 11:38 pm
Location: Manali

Post by arvind_ds »

Create new job parameters at job level itself and not the one that have been defined through DS Administrator. Pass the values into these parameters for the said job from the job sequence as $Variable_Name under value expression using insert job parameter option.

HTH
Arvind
arvind_ds
Participant
Posts: 428
Joined: Thu Aug 16, 2007 11:38 pm
Location: Manali

Post by arvind_ds »

Create new job parameters at job level itself and not the one that have been defined through DS Administrator. Pass the values into these parameters for the said job from the job sequence as $Variable_Name under value expression using insert job parameter option.

HTH
Arvind
Post Reply