Abort the job based on the condition

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
praburaj
Premium Member
Premium Member
Posts: 133
Joined: Thu Jun 30, 2005 1:26 am
Location: philippines

Abort the job based on the condition

Post 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.
prabakaran.v
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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?
-craig

"You can never have too many knives" -- Logan Nine Fingers
praburaj
Premium Member
Premium Member
Posts: 133
Joined: Thu Jun 30, 2005 1:26 am
Location: philippines

Post 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.
prabakaran.v
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Wrap the abort function in an if-then-else.
-craig

"You can never have too many knives" -- Logan Nine Fingers
BI-RMA
Premium Member
Premium Member
Posts: 463
Joined: Sun Nov 01, 2009 3:55 pm
Location: Hamburg

Post 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).
"It is not the lucky ones are grateful.
There are the grateful those are happy." Francis Bacon
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
praburaj
Premium Member
Premium Member
Posts: 133
Joined: Thu Jun 30, 2005 1:26 am
Location: philippines

Post 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 :? .
prabakaran.v
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

'Yes..It will work..Having two links,one for 'Y' and another for 'N'.
pandeeswaran
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kamtammystuff
Participant
Posts: 26
Joined: Fri Feb 19, 2010 2:08 am

Post 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
_____________________________________
-Kish
praburaj
Premium Member
Premium Member
Posts: 133
Joined: Thu Jun 30, 2005 1:26 am
Location: philippines

Post 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?
prabakaran.v
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply