Page 1 of 1

Sequential file error handling

Posted: Sat Nov 11, 2006 2:23 pm
by gmorgen1
I have a pipe-delimited Sequential File coming in that occasionally has rows truncated. It should have 3 columns, but sometimes the rows are truncated as below - this is an external provider file and we do not have control over it.

key1|10|text
key2|20|text
key3|
key4|40|text

In this case the process errors out with a fatal error -
Job1..Sequential_File_1.DSLink1: read_delimited() - row 3, column c, required column missing

How can I just write this bad row off to another file and notify someone of the erro and continue processing row-by-row. I do now want the whole process to abort in this instance.

Posted: Sat Nov 11, 2006 2:37 pm
by DSGuru79
In the sequential file you have an option to reject incorrect records. Use that opiton and use DSsendmail provided by datastage to send mail

Re: Sequential file error handling

Posted: Sat Nov 11, 2006 3:46 pm
by niranjansigeni
In Seq File, go to properties and In the Output tab go to format and select Delimiter as pipe " l ".


thanks

Posted: Sat Nov 11, 2006 3:56 pm
by DSguru2B
Welcome Aboard :)
Read your record as a single column and count the number of pipes, if less then 2 then send it down a reject link from the transformer. The constraint for the erraneous record will look something like

Code: Select all

DCOUNT(in.Link,"|") < 2
and for the good records it will look like

Code: Select all

DCOUNT(in.Link,"|") = 2
Then you can use the after-job subroutine to check for the size of the reject file, if its greater than zero then send out an email. You can do that by writing a small routine that uses the STATUS function. Search this forum as i posted a small routine to check for the file size using the STATUS function a while back.

Posted: Sat Nov 11, 2006 4:30 pm
by chulett
Or just use the options available in the Sequential File stage. :wink:

For the fields that are 'optional' i.e. that you may not receive - in this case #2 and #3 - slide the Columns tab over to the right until you can see the Incomplete column column. For those two, change it from Error (which is what is aborting your processing) to Replace or Retain - typically Replace to have them set to null or whatever your 'Missing columns action' setting is on the Format tab.

You can then check for null in those fields and do whatever is appropriate, including splitting them off to Rejection City. Your call.

Posted: Sat Nov 11, 2006 5:15 pm
by DSguru2B
O yea, the sequential file properties. Totally forgot about that. Thanks Craig.

Rejection city huh, cool :wink: