|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
need to process all rows with no parsing error |
« View previous topic :: View next topic » |
Author |
Message
|
tr |
Posted: Sun Apr 27, 2014 12:21 am Post subject: need to process all rows with no parsing error |
|
|
Novice
Joined: 30 Mar 2014 Posts: 11
|
I am inserting a delimited file into database.
sample input pattern:
emp name|emp_ID|empdept.
I am able to achieve this using fileinput node and compute. My next requirement is If there is any error in any input row(record), I want to discard all those rows with the same empdept and process rest of the file. But I am finding it difficult because if there is any error in the first input row, broker is stopping the parsing at that particular point and I am not able to process the rest of the file. Please help |
|
Back to top |
|
 |
Esa |
Posted: Sun Apr 27, 2014 3:25 am Post subject: Re: need to process all rows with no parsing error |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
tr wrote: |
if there is any error in the first input row, broker is stopping the parsing at that particular point and I am not able to process the rest of the file. Please help |
With any error you mean a parsing error? Then you could try to use a dfdl discriminator. But because empdept happens to be the last element of the record, this may be a little difficult. I think the discriminator should return true if you can parse the empdept. That would tell that the record exists and a parsing error further in the record would not cause an exception. It would be better if empdept was the first element of the record.
But I must admit that I haven't tested this myself.
If the errors are not parsing execeptions, a simple exit handler should do the job. But I suppose that's what you already have in your code. |
|
Back to top |
|
 |
kimbert |
Posted: Sun Apr 27, 2014 3:00 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
My next requirement is If there is any error in any input row(record), I want to discard all those rows with the same empdept and process rest of the file. |
I think that breaks down into multiple requirements:
a) continue processing the file after an error
b) discard any already-processed records that have the same 'empdept'.
c) work out what to do if the error occurs in one of the first two columns ( i.e. before empdept has been parsed ). As an example, what if the first delimiter gets missed out?
a) is fairly easy - model the 'record' as a choice of 'good record' and 'invalid record'. If the first branch of the choice fails, DFDL will back out and try the other branch. If you make the second choice branch a simple string field then it is not likely to throw any errors ( unless your data contains invalid characters or you set the character encoding wrongly ).
After making this change, invalid records will appear in the message tree with a different name, and you can write whatever logic you need for b) and c). _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|