Error Handling with DataStage TX 8.1

Formally known as "Mercator Inside Integrator 6.7", DataStage TX enables high-volume, complex transactions without the need for additional coding.

Moderators: chulett, rschirm

Post Reply
kiranredz
Premium Member
Premium Member
Posts: 21
Joined: Wed Aug 06, 2008 8:34 am
Location: United States

Error Handling with DataStage TX 8.1

Post 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
Kiran
rep
Participant
Posts: 82
Joined: Tue Jun 19, 2007 8:04 am
Location: New York City

.....

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