BizTalk Plane File Architecture – How to Accept LF or CRLF as a line separator

Our client sends us a flat file as input, and then we convert it to an XML file before sending to the target system.

Flat The file consists of multiple lines, and each line is separated by LF or CRLF.

How to create a flat file structure so that BizTalk can interpret each line of data, regardless of whether the line is composed of LF (0x0A) or CRLF (0x0D 0x0A) Separated?

The problem is solved. Here are the solutions others want to know:

Since both LF and CRLF share the LF character, I set the line separator to LF (0x0A). This is suitable for extracting the complete record (when CRLF is the separator, there is a side effect of an extra CR character at the end ).

You can use virtual fields to eliminate extra CR characters to absorb CR characters or use maps.

Please note that since LF and CRLF delimiters have different lengths (respectively 1 and 2 characters), so I had to make more changes to the mode to ensure that both are processed correctly.

In my scenario, each parsed line record contains 8 position fields , So there is an extra CR character at the end that causes an error, because Biztalk expects a certain length of the last field without considering the extra CR characters. The solution is to change the length of the 8th field (the padding field in my case) Add 1. However, in order to still be able to handle the LF line separator, please make sure to set the “Allow Early Termination” flag to true. In this way, if the last field is shorter than 1 character of its specified length (if CR character is not included), then No error will be raised.

Our client sends us a flat file as input, and then we convert it to an XML file before sending to the target system.

The flat file consists of multiple lines, each line is separated by LF or CRLF.

How to create a flat file structure so that BizTalk can interpret each line of data, regardless of whether the line is composed of LF (0x0A) or CRLF (0x0D 0x0A) separated?

The problem is solved. Here are the solutions that others want to know:

Since LF and CRLF share LF characters , So I set the line separator to LF (0x0A). This is suitable for extracting the complete record (when CRLF is the separator, there is a side effect of an extra CR character at the end).

You can use dummy Field to eliminate extra CR characters to absorb CR characters or use maps.

Please note that since LF and CRLF delimiters have different lengths (1 and 2 characters respectively), I had to change the pattern Make more changes to ensure that both are processed correctly.

In my scenario, each parsed line record contains 8 position fields, so there is an extra CR character at the end that causes the error , Because Biztalk expects a certain length of the last field without considering the extra CR characters. The solution is to increase the length of the 8th field (the padding field in my case) by 1. However, in order to still be able to handle the LF line separation Please make sure to set the “Allow Early Termination” flag to true. In this way, if the last field is shorter than 1 character of its specified length (if CR character is not included), no error will be raised.

Leave a Comment

Your email address will not be published.