Atul,
Not sure how you figure out whether a record is good or bad - you can use your flat file schema to validate the records upfront and then loop over the errors (returned by pub.schema:validate) to get all the offending records.
If you have a custom validation service instead, initialize a pipeline var (say) errString to blank. Loop over the records, invoke the validation service and if the record is a ‘bad record’, you can create a message appending to the errString with a new line at the end. Do this in each iteration of the loop and at the end of the loop, you can send out an email (pub.client:smtp) with errString as the body of the message.
A better approach to collecting all the errors would be - in each iteration of the loop, after validation service, create a message and append it to errString, if the record is bad. Instead of keeping this errString in the pipeline, you can save it in a repo store using services in pub.storage folder of WmPublic folder. After the loop, you can retrieve the errString from the store and then create an email using errString as the body.
As you can see, there are more than one ways of doing this… choose the one that fits your needs.
~Roh
#Integration-Server-and-ESB#Flow-and-Java-services#webMethods