Putting condition in the sequencer

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
Bilwakunj
Participant
Posts: 59
Joined: Fri Sep 10, 2004 7:00 am

Putting condition in the sequencer

Post by Bilwakunj »

In the sequencer, if one of the job had more than 5% of the data going on the reject link , how to stop sequencer without executing the next job?Can I use some job parameter or some thing in the trigger of the sequencer?
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

Use a routine stage.
Write a routine that receives a job name, a reject link name, a primary link name and a percentage value as input attributes:
- Attach the job.
- Find the reject and primary links and get the row counts.
- Calculate the percentage of rejected rows.
- Generate a log message with the total count and reject count with link names included.
- Set the return value to 0 if the reject percentage was below the allowable value or 1 if it was not to abort the job.

Make the percentage value a sequence job parameter so you can change it in production. Use this routine in multiple places. Keep to link naming conventions so all reject links have something in the name that identifies them as reject links. Your primary link with a count of rows being processed is not necessarily the first link in your job. If you send rows through an aggregator or filter before they reach the stage triggering the rejects then you need to make your total link the link just before that reject stage.

You should have multiple reject links in a job, consider a job with a sequential file source with a reject link, lookup reject link, transformer reject link and database insert reject link. In this case cycle through the link names matching "_rej" or "_reject" in them and sum them together and compare that value to your primary count.

Look at the DataStage BASIC manual for code examples. Also search for specific commands on this forum for lots of sample code, eg DSAttachJob.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

My solution is the same as Vincent's. In addition, to make it really clear (graphically) what's happening in the (7.5) job sequence, add a Terminator to send "Stop" requests to any running jobs.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply