Constraint to abort job

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

kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

ganesh123 wrote: something like this in Shell script ?
Or call the same Shell script in After-Stage Subroutine in Transformer, to check if Reject file is populated with data.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yes, either is possible. Could depend on what you want to happen with the 'good' rows after you've found all the 'bad' ones. If you are working in a database and you want your good changes to commit, do the check after job. If you don't then consider after stage.

In either case, make sure you put an Annotation on the canvas stating what you are doing. Those tend to be fairly invisible (heck, after stage is extremely invisible!) and this Best Practice ensures anyone who looks at the job knows there's more going on that just what's on the canvas. :D
-craig

"You can never have too many knives" -- Logan Nine Fingers
ady
Premium Member
Premium Member
Posts: 189
Joined: Thu Oct 12, 2006 12:08 am

Post by ady »

Thanks for the response guys...

In my case i'm comparing the counts in a job , ...

INPUTROW COUNT = OUTPUT ROWCOUNT (this is the constraint), if they are equal then the job should run. If not it should fail.

This job will be in a sequence, so even if the job fails after processing all the rows ... atleast it will stop the rest of the sequence.

Could I do it without adding a new file or a reject link to my existing job ?
ganesh123
Participant
Posts: 70
Joined: Tue Feb 20, 2007 3:22 pm
Location: NJ,USA
Contact:

Post by ganesh123 »

The condition is col1 = col2


ie: if col1 <> col2 then ABORT JOB
Thats why we gave you that soln.

make a stage variable

Code: Select all

sv=if @INROWNUM<>@OUTROWNUM then UtilitytoAbort("Message") else 1
use that in constraint in TX
If women didn't exist, all the money in the world would have no meaning.
-- Aristotle Onassis
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Code: Select all

@INROWNUM<>@OUTROWNUM
This alone can not frame a meaning full constrain. Unless you have other functional check or metadata mismatch, there wont be any reject and hence the above condition will always be true.
If its sequential file, count the number of rows using wc -l, and calculate the number of rows read by Datastage (without any error due to metadta mismatch) and raise abort signal after the job completion.
If you have any other condition, check for the number of rows processed in reject link and raise the Abort signal. If you sill want the job to be aborted, call a routine in after job as suggested many times.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Post Reply