Friday, February 23, 2007

How to waste half a day with EDI

Yes, thats EDI or Electronic Data Interchange.

The problem for me, is that one of our big customers wants to stop sending us Odette DELINS messages, and instead start using Edifact DELFOR messages. It's a problem for me, because I need to work out how to do it!

So let's start by seeing if we can translate a simple DELFOR file into the in-house format to feed into our ERP system. Let's created the test file, by copying & pasting the sample provided in the pdf of the specification. Simple... No...it does not work. Why? Every thing looks ok!

After hours of double checking & going around in circles. Finally the answer.

In an EDI file, each line is terminated with a ' character - thats ASCII code 0x27. But I finally realised that the lines in my file were terminated with character code 0x92, which looks very similar in the character set I was using.

When you use the correct terminating character, it all works a lot better!
So todays lesson is - be careful when you copy & paste text from a pdf!

1 comment:

Yemi Bedu said...

Hello,
Actually for EDIFACT you can tell what characters are used for delimiting records. First you find the field delimiter (character after UNB). then you search for the first UNH or UNG followed by the record delimiter. The character just before the UNH/UNG is your field delimiter. The delimiter set is (' field, + record, : sub-field).

Also ANSI X12 (an 830 would be a close equivalent transaction type) which does not have to have the same delimiters, has it set where you can programmatically pull the delimiters in a similar manner. That actually will expose all delmiters in one shot, but that will be discussed on another post. Good day.

Yemi Bedu