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
sumeet
Premium Member
Posts: 54 Joined: Tue Aug 30, 2005 11:44 pm
Post
by sumeet » Thu Nov 02, 2006 1:36 pm
Hi,
I am trying to pass a parameter to the job through Job control.
But its not taking the parameter.
Code: Select all
ErrorCode = 0
ParamName = 'PHID'
* ParamValue = PH02
JobHandle = DSJ.ME
JobName = DSGetJobInfo(JobHandle,DSJ.JOBNAME)
ErrCode = DSSetParam (JobHandle,ParamName, PH02)
Call DSLogInfo('SetParam ErrCode = ': ErrCode, 'Msg')
ErrorExit:
ErrorCode=1
Return
NormalExit:
ErrorCode=0
[/code]
The messege I get in the log is:
Test7Job..JobControl (Msg): SetParam ErrCode = -1
What is wrong here???
Thanks
Sumeet
ray.wurlod
Participant
Posts: 54607 Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:
Post
by ray.wurlod » Thu Nov 02, 2006 1:39 pm
The space between the function name and its left parenthesis is probably the culprit here.
Code: Select all
ErrCode = DSSetParam (JobHandle,ParamName, PH02)
Error code -1 decodes as "invalid handle".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sumeet
Premium Member
Posts: 54 Joined: Tue Aug 30, 2005 11:44 pm
Post
by sumeet » Thu Nov 02, 2006 1:47 pm
Ray,
I thought so but , still its not picking the param, even when I remove the space.
SHould I try doing it from a Before sub routine.
Thanks
Sumeet
ray.wurlod
Participant
Posts: 54607 Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:
Post
by ray.wurlod » Thu Nov 02, 2006 1:55 pm
You're not trying to set a parameter in the same job that's running?!!
Oh gosh, you are!!! (Notes use of DSJ.ME as job handle)
This is specifically prohibited. It's not possible. Job parameter values are set when the job starts, and cannot be changed thereafter.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sumeet
Premium Member
Posts: 54 Joined: Tue Aug 30, 2005 11:44 pm
Post
by sumeet » Thu Nov 02, 2006 2:41 pm
Thanks Ray for letting me know.
I had the same idea but the manual misguided me a bit.
Code: Select all
JobHandle is the handle for the job as derived from DSAttachJob, or it
may be DSJ.ME to refer to the current job.
So I am going for Before Job Subroutine.
Thanks
Sumeet
ray.wurlod
Participant
Posts: 54607 Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:
Post
by ray.wurlod » Thu Nov 02, 2006 3:17 pm
It still won't work. "Before-job" is a misnomer; "before-rows" would be a better name. The job is already running when the before-job subroutine is executed.
You can only set parameter values externally. For example in a job sequence. There you can do so from user variables, the result of a routine, the result of a command, to name a few.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.