Design job flow based on tgt table row count.

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
sspreethi
Participant
Posts: 25
Joined: Mon Dec 01, 2003 2:27 am

Design job flow based on tgt table row count.

Post by sspreethi »

Hi All,

I have a requirement where based on tgt table rowcount in a job, I have to branch my sequencer flow. Please let me know if there is a way to acheive this from Sequencers.


JobA -> JobB (if tgtrows of JobA=0) -> JobD (if tgtrows of JobB=1) -> JobE, etc...

-> Jobc (if tgtrows of JobA=1)

After JobA, if tgt rows of JobA is 0 Then run JobB else run JobC. After JobB, if tgt rows of JobB is 1 then run JobD

Preethi
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Re: Design job flow based on tgt table row count.

Post by gateleys »

How are you counting the rows to target? If you are writing the count to a file in each job, then you will have to use a Execute Command stage after each job to return the count, and then set the Triggers as follows -
JobA Trigger (to JobB) : ExecuteCommand_A.$ReturnValue = 0
JobA Trigger (to JobC): ExecuteCommand_A.$ReturnValue = 1

JobB Trigger (to JobD) : ExecuteCommand_B.$ReturnValue = 1

You may handle other ReturnValues accordingly.
gateleys
richdhan
Premium Member
Premium Member
Posts: 364
Joined: Thu Feb 12, 2004 12:24 am

Post by richdhan »

Hi Preethi,

This can be done but you have to create a basic routine which should contain Basic code something like this and return the record count

JobHandle = DSAttachJob(jobname,DSJ.ERRWARN)
rowcount = DSGetLinkInfo(JobHandle,stagename,linkname,DSJ.LINKROWCOUNT)

Do a search on Server Forum. It has many samples.

Use the Routine Activity after each Job Activity and call the custom routine to find the rowcount. Then you can branch out based on the output.

HTH
--Rich
sspreethi
Participant
Posts: 25
Joined: Mon Dec 01, 2003 2:27 am

Post by sspreethi »

Thanks a lot Rich & Gateleys.
I tried the second one & it worked perfect...
Post Reply