Setting Job Parameter in Before Job Subroutine

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
lata walekar
Participant
Posts: 6
Joined: Sat Dec 10, 2005 12:41 am
Contact:

Setting Job Parameter in Before Job Subroutine

Post by lata walekar »

Hi !

Is it possible to set the parameters of a job from its before routine itself ? Actually, I want to set the starting value for the surrogate key generator for which I have created a job which fetches the maximum value generated from the database and this value has to be set in the job. I am able to set the parameter from a server routine but when the same was tried with a before routine it did not work. The code used is:

Code: Select all


$INCLUDE DSINCLUDE JOBCONTROL.H 


ErrorCode = 0      ;* set this to non-zero to stop the stage/job

TableName = LEFT(InpParam,INDEX(InpParam,',',1)-1)
ColName = RIGHT(InpParam,LEN(InpParam) - INDEX(InpParam,',',1))


* **********GET MAX****************** 

JobHandle = DSAttachJob("JOB_GET_MAX_ID", DSJ.ERRNONE) 

ErrorCode = DSSetParam(JobHandle,"JOB_TBL_NME",TableName)
ErrorCode = DSSetParam(JobHandle,"JOB_ID_COL",ColName)

ErrorCode = DSRunJob(JobHandle, DSJ.RUNNORMAL)
ErrorCode = DSWaitForJob(JobHandle)

If MaxVal <> 1 then MaxVal = MaxVal + 1

MaxVal = DSGetJobInfo (JobHandle,DSJ.USERSTATUS)


* **********GET MAX****************** 




JobHandle1 = DSAttachJob(DSJ.ME, DSJ.ERRNONE)
ErrorCode = DSSetParam(JobHandle,"JOB_ID_START",MaxVal)

balajisr
Charter Member
Charter Member
Posts: 785
Joined: Thu Jul 28, 2005 8:58 am

Post by balajisr »

HI

No it is not possible to set value to the job parameter in before job subroutine.

Please do a search on this forum. It has explained this process many times.

--Balaji S.R
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: Setting Job Parameter in Before Job Subroutine

Post by chulett »

Welcome! :D
lata walekar wrote:Is it possible to set the parameters of a job from its before routine itself ?
Short answer is no. Stick with your 'server routine' which I assume means via a Job Sequence.
-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 »

Long answer is "No". :lol:
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
alisoviejo
Participant
Posts: 49
Joined: Fri Nov 11, 2005 10:19 am

Post by alisoviejo »

Hi,
I am calculating a date value in Job1 , now I need to pass this value to Job2 (as a parameter so that it can be used in the join condition) without landing the data into a dataset or table, can I acheive this using any stages in the sequencer ?

Thanks,
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

You can use the user return variable, this method has been discussed a number of times, I just found this thread on the subject
alisoviejo
Participant
Posts: 49
Joined: Fri Nov 11, 2005 10:19 am

Post by alisoviejo »

Hi ,
Thanks for the reply, looked at it, and tried to develop a PX job which stores the value into a stage variable, and I am struck on how to retrieve this a s user status or parameter for the next job in a job seq.

Appreciate your help
ALISO
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

You should keep retrieving your surrogate key start value back at the sequence job level via a routine. It can be difficult getting the maximum key value used from within a parallel job as you have multiple instances of transformers and surrogate key generators in action and no easy way to get the last value used out of the job.

Write a reusable routine that gets the last key value used and call it before each job activity stage that calls a key generator job.
vinaymanchinila
Premium Member
Premium Member
Posts: 353
Joined: Wed Apr 06, 2005 8:45 am

Post by vinaymanchinila »

Hi,
I am not looking for the surrogate key value, I am calculating DATE value in Job1 and need to pass it as parameter to the next job in a seq.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Check the post Arnd linked to, three posts up from yours. It explains the process.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply