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.
Sequential file error handling
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 7
- Joined: Sat Sep 09, 2006 7:01 pm
- Location: Jersey
Re: Sequential file error handling
In Seq File, go to properties and In the Output tab go to format and select Delimiter as pipe " l ".
thanks
thanks
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
and for the good records it will look like
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.
![Smile :)](./images/smilies/icon_smile.gif)
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
Code: Select all
DCOUNT(in.Link,"|") = 2
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Or just use the options available in the Sequential File stage.
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.
![Wink :wink:](./images/smilies/icon_wink.gif)
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.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers