Page 1 of 1

Error Handling with DataStage TX 8.1

Posted: Thu Jul 23, 2009 3:51 am
by kiranredz
Hi,
I am trying to have the error records in an error file and also attach the custom error description for the error records.
Looks like I cannot define an error message if I place a restart button on the record and use Reject() function to capture the error record in an error file.
Ex: If i my source type tree has the following items under the group RECORD:
ID TEXT(5), NAME TEXT(10), DATE_OF_BIRTH TEXT(8)
Say, all these fields are nullable fileds - can hold nulls.

My TargetType tree has the following items under the group RECORD:
ID NUMBER(5), NAME TEXT(10), DATE_OF_BIRTH DATE
Fields ID and NAME are not nullabe in the target.

I place a restart on the RECORD group of Target.

And, I am suppose to do a direct mapping of the items in the map.
Rules for mapping:
ID from source to be converted to Number in the Target.
DATE_OF_BIRTH from source to be converted to Date in the Target.

Incase I get Null Values in the ID field or NAME field or, there is a conversion error for the fields ID and DATE_OF_BIRTH the record will move to the Reject buffer. And I can capture it in a file by assigning an item to =REJECT(RECORD Group).

Now, my requirement is that along with the record I need to put my custom error message.
Ex: If the error records are
ID, NAME, DATE_OF_BIRTH
Null,ABC,12-04-2007
001,Null,12-04-2007

I need them like this:
ID, NAME, DATE_OF_BIRTH, Error_Description
Null,ABC,12-04-2007,Contains Null values for Not Null fileds - ID
001,Null,12-04-2007,Contains Null values for Not Null fileds - NAME

Guru's,
Can you please help me achive this?
Thanks in advance.

Kiran

.....

Posted: Thu Jul 23, 2009 2:00 pm
by rep
In your reject functional map, do;


IF(WORD(ERROR_REC, "," 1)="", ERROR_REC + "Contains Null values for Not Null fileds - ID ", //else
IF(WORD(ERROR_REC, "," 2)="", ERROR_REC + "Contains Null values for Not Null fileds - NAME ")

Does that sound like it might work?

WORD does on the fly delimiting.