Page 2 of 2

Posted: Sat Mar 10, 2007 2:31 am
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.

Posted: Sat Mar 10, 2007 6:53 am
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

Posted: Mon Mar 12, 2007 9:48 am
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 ?

Posted: Mon Mar 12, 2007 10:02 am
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

Posted: Mon Mar 12, 2007 8:53 pm
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.