Fatal error while calling a job from Job Control Code

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
dodda
Premium Member
Premium Member
Posts: 244
Joined: Tue May 29, 2007 11:31 am

Fatal error while calling a job from Job Control Code

Post by dodda »

Hi all,

I need some help regarding calling a job from job control code .

Iam having one job Test_Job which takes data from oracle table and load's into the sequentail file.

And DSNAME, DSUSER are environmental variables. And the job ran fine.

But when i tried to call from job control i got some fatal error like.And batch job is :: Batch_Test

Batch_Test..JobControl (fatal error from DSSetParam): Job control fatal error (-1)
(DSSetParam) Invalid job handle <Missing or NULL>

I wrote below code in the job control

hJob2 = DSAttachJob("Test_Job ", DSJ.ERRFATAL)

errcode = DSSetParam(hJob2, "DBNAME",$DBNAME)
errcode = DSSetParam(hJob2, "DBUSER",$DBUSER)
ErrCode = DSRunJob(hJob2, DSJ.RUNNORMAL)

And i used DBNAME,DBUSER as environmental variables in the batch job.
And i'm trying tyo pass DBANME,DBUSER values from the Batch job to the calling job.

Any ideas what i'm missing.

Thanks in advance
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Check whether your DSAttachJob was successful.
dodda
Premium Member
Premium Member
Posts: 244
Joined: Tue May 29, 2007 11:31 am

Post by dodda »

Thanks for your quick reply.

Can you please clarify me on the below piece of code . I used the DBNAME,DBUSER as an environmental varibles in the batch job and set default value as $PROJDEF .And i want to pass those values to the calling job

errcode = DSSetParam(hJob2, "$DBNAME",$DBNAME)
errcode = DSSetParam(hJob2, "$DBUSER",$DBUSER)

And the syntax for DSSetParam is::
ErrCode = DSSetParam (JobHandle, ParamName, ParamValue)

Can i give $PROJDEF in the ParamValue.
So how can ipass the those parametrs to the calling job.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You can not give $PROJDEF. Because it's your own code, you need to interrogate the value of the environment variable and provide that value in DSSetParam().
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dodda
Premium Member
Premium Member
Posts: 244
Joined: Tue May 29, 2007 11:31 am

Post by dodda »

Thanks ray for your information,
Just a quick question

Can i pass parameter value like below line?

errcode = DSSetParam(hJob2, "$DBNAME",$DBNAME)
Correct me if anything was wrong.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

If you have set them as $PROJDEF in the job and those values are correct for the project, then there's absolutely no need to 'set' or pass them to the job in any fashion. That's the whole point, after all. Unless you are trying to override the project default, of course... are you?

To that same point, a job parameter who's value is $DBNAME does not need to be explicitly set to $DBNAME to run it, it will automatically pick that value up from the environment. Again, the whole point.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You can not use an environment variable name directly as the third argument of DSSetParam(). DataStage BASIC does not recognize environment variables.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply