Reputation: 13006
Initially I was thinking to use SSIS to parse an EDI file, however I've seen a few manual EDI parsers (field mapping), and would like to use automate this functionality in C#.
Example EDI File:
Upvotes: 21
Views: 42240
Reputation: 4859
There is EDI.Net library which is opensource and supports all three known EDI formats (X12, EDIFact, Tradacoms). In your case for X12 you need to provide a custom implementation of the IEdiGrammar
with the following presets.
public class EDI_X12Grammar : IEdiGrammar
{
...
}
var grammar = new EDI_X12Grammar()
{
ComponentDataElementSeparator = new[] { '>' },
DataElementSeparator = new[] { '*' },
DecimalMark = null,
ReleaseCharacter = null,
Reserved = new char[0],
SegmentTerminator = '~',
ServiceStringAdviceTag = null,
InterchangeHeaderTag = "ISA",
FunctionalGroupHeaderTag = "GS",
MessageHeaderTag = "ST",
MessageTrailerTag = "SE",
FunctionalGroupTrailerTag = "GE",
InterchangeTrailerTag = "IEA",
};
Disclaimer I wrote the library.
Upvotes: 19
Reputation: 7584
This is for X12 and worked pretty well for my uses:
http://x12parser.codeplex.com/
It's command line, and just outputs an XML file for your EDI file.
You could possibly adapt it for your purposes.
Upvotes: 2
Reputation: 4097
I am not sure if you are open to commercial tools, but I am throwing this link out here just in case. It might help somebody. Disclaimer: I am not connected in any way to this provider.
FRAMEWORK EDI - EDI Tools for Programmer (Commercial Framework) - Find it here: http://www.edidev.com/
Upvotes: 0
Reputation: 1607
I'm not familiar with the EDI file format, but would either of these help:
Upvotes: 1