DSSetParam

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
luca
Participant
Posts: 81
Joined: Wed May 14, 2003 11:34 pm

DSSetParam

Post by luca »

Hi !
I have code created by a job sequencer which I have copy in an other job control to add some code for retrieving parameters for the jobs runned by this job control.
I changed my code for DSSetParam like this:
err$code = DSSetParam(h$5, ParamName, ParamValue)
(where ParamName is the variable which contains the value param1)
instead of
err$code = DSSetParam(h$5, "param1", ParamValue)

The result I have when running the job control is:
*HARDCODING
* err$code = DSSetParam(h$5, "param1", ParamValue)
*WORKS
*BUT
err$code = DSSetParam(h$5, ParamName, ParamValue)
*DOESN'T WORK
with the following error:
TstJctlGetJobParamAndRunJob..JobControl (@TstParamJob): Controller problem: Error calling DSSetParam(param), code=-3
[ParamName does not reference a known parameter of the job]

What should I do for DS to process ParamName as a variable (it seems it is processing it as a string) in the job control ?

Thanks
mihai
Participant
Posts: 30
Joined: Thu Mar 13, 2003 5:24 am
Location: Hertfordshire

Post by mihai »

Hi Luca

Looking at your code, nothing seems out of order. (Must admit that I'm on DS 4.2, thus 'job sequencer' is strange talk).

We use a very similar method - a bit like this..

----------
deffun GetParamValueViaODBC('param name') calling 'DSU.GetParamValueViaODBC'
*** DataStage routine that grabs a parameter value from a predefined ODBC table


job.handle = DSAttachJob(job.name,DSJ.ERRFATAL)


param.list = convert(',',@AM,DSGetJobInfo(job.handle,DSJ.PARAMLIST))

for cur.param = 1 to dcount(param.list,@AM)
ErrCode = DSSetParam(job.handle, param.list,GetParamValueViaODBC(param.list))
if ErrCode 0 then
.... error handling code
end
next cur.param

... some other statements

ErrCode = DSRunJob(job.handle)


next cur.param
---------
This works fine for us. I suggest you diagnose the problem a bit more by tactical deployment of Call DSLogInfo('Parameter to assign =':ParamName,'DEBUG') prior to the DSSetParam. It may be that you're picking up the wrong parameters from somewhere and the DS message is totally valid.

Kind regards,
Mihai

_________________
desk: 01908448571
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

DSSetParam is a proper function, which means (among other things) that it can take a variable name in any argument position.
I suspect that the variable is not being correctly assigned in the first place.
You should ALWAYS check the exit status of DSGetParamInfo() and DSSetParam() function calls, in case "someone" has played with the job's parameter grid. In particular check for DSJE.BADPARAM (that parameter name does not exist) and DSJE.BADVALUE (that value is not appropriate for the parameter type, for example "FRED" for a Date type).


Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
luca
Participant
Posts: 81
Joined: Wed May 14, 2003 11:34 pm

Post by luca »

"I suspect that the variable is not being correctly assigned in the first place."

That's true, I was keeping the Quote characters from the file.
Thanks Ray !
Post Reply