I am looping over a document which is nothing but bunch of records and mapping each record to a common message in WM. It is one to one mapping. Somehow there is a space in the source data and once WM produces output It is adding an extra blank line at the end of the file. How can I eliminate the issue?
Try using pub.string:trim service before mapping the document.This will eliminate the extra space from source and you will not get the xtra line in end.
I am not sure that will work. pub.string:trim can only be used at the variable level not at the document level. For me the space is at the end of the record. What I am looking for is to pre scan the document to check whether it contains space at the end of the record. here is the structure of my document and the space is caused if user hit the carriage return.
How is the IS document being created? From a Broker document? A flat file? An XML document? This may be something to solve on the “source” side.
It is a flat file data…
Please provide as much detail as you can about the flat file, how you’re parsing it, the mapping, etc. That way someone can advise about the “right” spot at which to ignore the space and/or blank record.
Replace the carriage return using string.replace …
have you defined a schema for reading the flat file? check if the record end character in the schema is carrage return. If so, replace it with appropraite record end character.