Page 1 of 1

Abort the job based on the condition

Posted: Mon Dec 12, 2011 5:53 am
by praburaj
Hi All,

One of my source file column name is Item where records are like below

100
200
300
100
100

If any records come other than 100 in Item column, I need to abort the job.

Any help is really apprecidated.

Posted: Mon Dec 12, 2011 7:08 am
by chulett
What have you tried, anything?

I'd also be curious if you need to abort when the first is detected or do you need to report them all and then abort?

Posted: Mon Dec 12, 2011 7:19 am
by praburaj
I have tried with utility abort log option. But job got failed. I need to abort the job when the condition is not met.

Posted: Mon Dec 12, 2011 7:25 am
by chulett
Wrap the abort function in an if-then-else.

Posted: Mon Dec 12, 2011 9:17 am
by BI-RMA
You could also use a lookup for Item-Value 100 and set the condition for Lookup-Failure to "Fail" (Default).

The job will abort when a row comes along with a different value for column Item. If so needed, You can also provide additional lookup-values later without necessarily having to change your job (use a file or DB-table as input).

Posted: Mon Dec 12, 2011 9:29 am
by chulett
Yes, you could, but I'm not sure I'd add the 'complexity' of a lookup when this can be solved with either the proper expression or a simple constraint to a reject row set to abort after 1 row.

Posted: Mon Dec 12, 2011 12:08 pm
by praburaj
Thanks for your reply chulett. right now I am not infront of datastage. But I am going to write a derivation like I mentioned below.

StgVar:

If Inlink.Item<>"100" Then 'Y' Else 'N'

Constraint:

StageVar='Y' Abort After rows=1

Hope this logic will abort my job.

Please let me know, If do anything wrong in the derivation :? .

Posted: Mon Dec 12, 2011 12:25 pm
by pandeesh
'Yes..It will work..Having two links,one for 'Y' and another for 'N'.

Posted: Mon Dec 12, 2011 5:15 pm
by chulett
I personally don't do the Y/N thing, preferring to treat the stage variable as a Boolean since the expression will automatically resolve to true or false. I'd also suggest you always use meaningful names for your stage variables.

Code: Select all

Stage Variable
svItemIs100:  Inlink.Item = 100

Constraint
Good row:     svItemIs100
Bad row:      Not(svItemIs100)
Of course, the bad row output link could just be marked as a 'Reject' link and not need a derivation.

Posted: Mon Dec 12, 2011 11:19 pm
by kamtammystuff
praburaj wrote:Thanks for your reply chulett. right now I am not infront of datastage. But I am going to write a derivation like I mentioned below.

StgVar:

If Inlink.Item<>"100" Then 'Y' Else 'N'

Constraint:

StageVar='Y' Abort After rows=1

Hope this logic will abort my job.

Please let me know, If do anything wrong in the derivation :? .
This will work

Posted: Tue Dec 13, 2011 1:08 am
by praburaj
Thanks to everyone. I resolved my problem. :D

Is there any way to write this concept in routine? If yes, how can I do that?

Posted: Tue Dec 13, 2011 7:34 am
by chulett
A parallel routine? How are your C++ programming skills? Regardless, I don't see the point - stick with whatever your current resolution is.