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:
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:
Have you seen http://www.codeproject.com/KB/XML/edix.aspx
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.
Have you seen http://www.codeproject.com/KB/XML/edix.aspx
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.
I'm not familiar with the EDI file format, but would either of these help:
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/
© 2022 - 2024 — McMap. All rights reserved.