Using DSSetParam and DSGetParamInfo in a job control

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
nisaumande
Participant
Posts: 13
Joined: Fri Aug 11, 2006 11:57 am
Location: Toulouse, France

Using DSSetParam and DSGetParamInfo in a job control

Post by nisaumande »

Hi,

I'm facing a situation I do not understand, even if everything is working ok.
Maybe someone know how this work ?

I'm using a job control in order to get the parameters values to execute a job sequence.
I'm doing something like this in order to get the parameters list :

ParamList = DSGetJobInfo(JobId, DSJ.PARAMLIST)
NbParam = DCount (ParamList, ',')

And then I get the parameters values from a configuration file, and use this command for each parameter :

ErrCode = DSSetParam(JobId, ParamName, ParamVal)

That is working fine, I get the good parameters for the execution of the job.

The strange thing is when I add that code after the alimentation of the parameters values in order to verify the alimentation :

For i = 1 to NbParam
ParamName= Field(ParamList, ',', i)
ParamType= DSGetParamInfo(JobId, ParamName, DSJ.PARAMTYPE)
If ParamType <> DSJ.PARAMTYPE.ENCRYPTED
Then
ParamVal = DSGetParamInfo(JobId, ParamName, DSJ.PARAMVALUE)
CALL DSLogInfo(NomParam : " for verification : " : Param Val, ProgramName)
End
Next i

The values I get from the command DSGetParamInfo are the default values, and not the values I've just assigned to the parameters.
Am I doing something wrong ?


Thanks for your help,

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

Post by ray.wurlod »

No you are not doing anything wrong, this is one of those strange behaviours of DataStage. If you run the job, and retrieve the parameter values afterwards with DSJ.PARAMVALUE, you will get back what you set. But, until the job has run, you do not.

It is sufficient, in your case, to test the value returned by DSSetParam. If it is zero (DSJE.NOERROR), then all is well. If it is a negative integer, then there was some kind of a problem, such as DSJE.BADPARAM or DSJE.BADVALUE. Mnemonics are declared in the JOBCONTROL.H header file.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
nisaumande
Participant
Posts: 13
Joined: Fri Aug 11, 2006 11:57 am
Location: Toulouse, France

Post by nisaumande »

Ok, thanks for your answer.
Too bad I can't read the post, but I get the point from the first sentence :wink:


About the online help on the DSGetParamInfo function :
DSJ.PARAMVALUEString - Current value of the parameter for the running job or the last job run if the job is finished.
Maybe we can say that as I do not have started the job yet, the values I get are those of the previous run ?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

nisaumande wrote:Maybe we can say that as I do not have started the job yet, the values I get are those of the previous run ?
Yes. And as an FYI, I've never bothered to check to that level. Simply checking the status of the DSSetParam function is sufficient:

Code: Select all

ErrCode = DSSetParam(JobId, ParamName, ParamVal)
If ErrCode # DSJE.NOERROR Then
   (error code)
End
-craig

"You can never have too many knives" -- Logan Nine Fingers
nisaumande
Participant
Posts: 13
Joined: Fri Aug 11, 2006 11:57 am
Location: Toulouse, France

Post by nisaumande »

chulett wrote:And as an FYI, I've never bothered to check to that level. Simply checking the status of the DSSetParam function is sufficient:

Code: Select all

ErrCode = DSSetParam(JobId, ParamName, ParamVal)
If ErrCode # DSJE.NOERROR Then
   (error code)
End
Actually I wanted to check the values I got from the parameters files rather than the action of assigning the value.

But I'll do the DSLogInfo when retrieving the values.

Thanks !
Post Reply