|Just another Perl shrine|
Re: 850 EDI Helpby lhoward (Vicar)
|on Oct 02, 2002 at 11:34 UTC||Need Help??|
I don't know of any X12 EDI perl modules, but I used to work for a company that did EDI (I even wrote a perl program that colorized/pretty-formatted X12 EDI). The following is purely from memory and may not be quoite right, but I hope you find it helpful.
X12 EDI documents are basically deimited files (i.e. split works great on them). Their are record separators, element separators, and sub-element separators. The first record in any X12 document is the ISA header, and this is fixed-length, so you can use it to find what all the separators are.
Once you know the separators, if you split the document on the record separator, you'll see its structured as follows (indentation added for clarity). If you then separate each record into elements by splitting on the element separator, the first element of each record is its record type:
ISA GS ST .. one transaction in here SE ST .. SE GE GS ... GE IEA
i.e. the ISA/IEA records are the "document header and footer", it can contain one or more groups (delimited by GS/GE), each group contains one or more transactions (delimited by ST/SE). These ST/SE are the individual transactions (your 850, among others)
The 2 outer envelopes (ISA/IEA and GS/GE) contain routing information that indicates how to deliver the transcations. Within the ST/SE section are all the records that make up the individual 850. I don't remember what the exact records are.
Within the ST/SE block each record corresponds to specific information about the transaction.
That's about all I can remember for now. I'll post more if I can remember any other information in the structure of 850s....