1

I'm building my own MT940 parser and I'm running into something that seems to be unspecified issue.

The specification of a :61: tag, states that it ends with a variable amount of characters (34x). From an example file I see that they can continue on the next line.

For example:

:61:1510151015C54,01NTRFNONREF//15288910043499
/TRCD/00100/

How do I determine if the next line is a new tag or if it is a continuation of the content of the preceding tag. It seems that looking for an :xx: pattern at the beginning of the line is naive as it could cause a bug in the exceptional situation where the content actually contains that specific pattern.

Corno
  • 5,448
  • 4
  • 25
  • 41

1 Answers1

0

Every line that starts with a tag such as :61: is a new line of information in the format. If it doesn't start with such an tag then it's a continuation.

Small word of warning though. MT940 is a standard, but there are subtle differences per bank. So it might be that works for one, but doesn't work for another. For instance some specifications have a header that defines that start of a transaction, but others don't.

Jaco
  • 1,149
  • 1
  • 9
  • 14
  • Are you saying that the code that supplies the message needs to validate that the continuation is not starting with this 'magical' sequence of characters? In other words: the code sees that the continuation contains ':61:' and it would be placed at the beginning of a line, so it will place a line break at another place in the string? – Corno Oct 19 '15 at 08:30
  • Indeed. If the line doesn't start with :nn: then its a continuation. You can simply parse it from the top down and check each next line. – Jaco Oct 19 '15 at 15:01
  • that would make it a really horrible protocol (determining the position of newlines in a string based on content of that string), but looking at all the information I have read, it might be that you are right. – Corno Dec 02 '15 at 23:25
  • Indeed it is. If you have the possibility to switch format you should take a look at camt.053. I don't know why you are writing your own parser, or in what language you are writing, but there are existing solutions such as https://bitbucket.org/raptux/sharpmt940lib – Jaco Dec 03 '15 at 07:52