How to eliminate a space issue in WM.

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?

Mona,

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.

Thanks,
Amol.

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.

Document
string1
string2
string3
(space)

thanks.

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.

Hi Reamon,

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 …

–Shaik

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.