DB2/UDB API Reject Link

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
Raftsman
Premium Member
Premium Member
Posts: 335
Joined: Thu May 26, 2005 8:56 am
Location: Ottawa, Canada

DB2/UDB API Reject Link

Post by Raftsman »

I have searched and read all articles related to this, even the Leakage article and still I can't find an example on how to capture rejects due to duplicate entries.

As I am still learning the product, I can't find any good examples on how to set this rejectlogic up. I create a test job where I read from one DB2 Table and try to insert it into another that contain the same records. This will cause a duplicate. I used the tranformer stage but I am not sure what I need to do. Is there a constraint I must add or something. I am not sure if I am suppose to capture the SQLSTATE = 23505... etc. I agrre that there is alot of posts on this but none really clearly state how to accomplish this problem.

Could someone please shed some more light on this. Maybe it will decrease the amount of posts that have been written on the subject.

Thanks.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

In the transformer, specify the constraint as OTHERWISE for your reject link. See if that works. I am not sure if DB2 API supports reject links. The enterprise stage does.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

In parallel jobs it's not done in the Transformer stage. DB2 rejects are captured by a reject link on the DB2 stage.

However, better practice is to detect the duplicates upstream. The easiest way is a Sort stage that generates a Key Change column. The second easiest way is to use stage variables in a Transformer stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
asitagrawal
Premium Member
Premium Member
Posts: 273
Joined: Wed Oct 18, 2006 12:20 pm
Location: Porto

Post by asitagrawal »

Hi Raftsman,

Even I tried to implement the same logic.. but it did not workout by using the SQLSTATE at the constraint.

As a workaround, I fetched the keys for the table into a Hashed file and then in the job determined whether it is an Update ( i.e already existing ) or an Insert.

HTH,

Regards.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Hashed files are not present in px jobs.
Last edited by DSguru2B on Wed Feb 21, 2007 3:28 pm, edited 2 times in total.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

In a parallel job?!! Good trick!
:roll:
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply