abort the Job

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
prasad v
Participant
Posts: 174
Joined: Mon Mar 30, 2009 2:18 am

abort the Job

Post by prasad v »

I want to make job aborted when there is no records to update in the target table, can anyone tell me how can we achieve this?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Why abort? Why not prevent the job from running in the first place?

Either way is possible. Run a command that checks the existence of the files and sets its exit status how you wish. Then test that.

If you're using a before-job subroutine, set ErrorCode to a non-zero value to abort the job.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Clarify what you mean by "no records to update in the target table". Ray went with "no records in the source" but I'm wondering if you mean you send an update to the target and it updates zero records? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

One more way i can think of is, get the Link count using DSGetJobInfo() and abort if it's 0.
pandeeswaran
prasad v
Participant
Posts: 174
Joined: Mon Mar 30, 2009 2:18 am

Post by prasad v »

Thanks to everyone for all your replies.

Ray: I could not know whether there are records in the target table to update. because i get the rows from source table and update to target table. I know while updating only.

Craig: Yes craig, If there are no matching records in the target table. we get rows in the source.

Pandeesh: I believe we can use that function in Transformer only.
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

So,first of all find out whether there are any matching records are there or not using Lookup or join,After that based on the count decide needs to abort or to update.
pandeeswaran
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

prasad v wrote:Yes craig, If there are no matching records in the target table. we get rows in the source.
That's one of the things the lookup stage is for.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Nagac
Premium Member
Premium Member
Posts: 127
Joined: Tue Mar 29, 2011 11:39 am
Location: India

Post by Nagac »

that works !! but I want to make the job abort when it fails to update atleast one record.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I'm not going to have the exactly correct terminology but (from what I recall) you can set the Lookup to Fail if a match is not found...
-craig

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