Page 1 of 1

Putting condition in the sequencer

Posted: Mon Dec 19, 2005 4:22 pm
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?

Posted: Mon Dec 19, 2005 4:38 pm
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.

Posted: Tue Dec 20, 2005 1:02 am
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.