Page 1 of 1

DSSetParam

Posted: Thu Feb 27, 2003 6:34 am
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

Posted: Thu Feb 27, 2003 7:49 am
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

Posted: Thu Feb 27, 2003 11:18 pm
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

Posted: Fri Feb 28, 2003 12:19 am
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 !