Handling DataBase Rejects/Error conditions

Archive of postings to DataStageUsers@Oliver.com. This forum intended only as a reference and cannot be posted to.

Moderators: chulett, rschirm

Locked
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Handling DataBase Rejects/Error conditions

Post by admin »

If one is interested in "trapping" rejected rows. (e.g. dup key rejections from the database or other database constraints). Design the job as follows;


SourceStage----readlink---->TransformerStage-----insertlink----->TargetR
SourceStage----readlink---->TransformerStage-----insertlink----->DBMS
rejectlink
SeqFileStage


In the constraint screen (for the transformer stage) check "rejects" =Yes on the rejectlink. The result will be that if either the constraint on the insert link fails or if the database rejects the insert/update the row will pass out the reject path (based upon what youve mapped). You can also create a reason column in the reject link. In the derivation for the reason column right click (or hit the ...) to drop down the menu options. Select "Link Variables", "outputs" then the insertlink. This will provide you a list of error conditions/msgs that you can add to this row when the reject condition occurs. If you select "LastErr" you will get the entire log message that gets logged when a database constraint reject happens (dup key, RI, null etc) If you want the specific database error number select "DBMSCODE" which will load the value of the respective database error code. This is a powerful feature of DataStage especially when you consider that you can react to the specific error condition when it occurs. e.g. If DBMSCODE = dup key then generate a key followed by another attempt to insert, if null constraint test columns for null then fill with default value..

-Allen ________________________________________________________________________________

Allen Spayth daspayth@wwc.com
Locked