EDI segments contain the basic units of data in an EDI file. In fact an EDI file contains only segments. In this article we will discuss the X12 segment structure and how it’s used to create EDI messages.
Let’s say we want to send a basic company name information to another party. We can use the NM1 segment as an example. This segment is used to put an individual or a company name in an EDI file. Notice that ‘NM’ part of the segment name. It’s actually an abbreviation for ‘Name’. Most, if not all, EDI segment name convey the type of data that they will represent. For example:
NM1*40*1*ABC Corp*A:B:C*SS~
This segment contains many pieces of information that is necessary for parsers to understand the data. The actual parts of the segment are:
Important Terms
- Segment Name: The name of the segment (NM1)
- Element Separator: A special character used to separate each data element (*)
- Segment Separator: A special character used to mark the end of a segment (~)
- Data Element: Actual data (40,1, ABC CORP, SS)
- Composite Element: More than one data element grouped together in a logical unit (A:B:C)
- Composite Element Separator: A special character used to separate composite data elements (:)
The Delimiters of an EDI file are the Element Separator, Segment Separator, and Composite Element Separator characters. Delimiters can differ from company to company and file to file. EDI parsers use these special characters to correctly parse segments in order to get data.
Data elements can represent many types of data, for example:
- Text or Strings
- Numeric
- Time
- Dates
- Date and Time
- Identifiers ( codes that qualify data)
Data element also have a minimum and maximum length. Text or Strings are usually longer than Identifiers for example. EDI parsers can now be able to not only verify the content of data elements but also their allowable lengths.
Complex Element Types
Composite Elements
In certain cases a data element is not specific enough to describe data. The solution to this is a Composite Data Element. For example:
CLM*194*75.00***11::1*N*C*Y*Y*C
EDI parsers can recognize composite data elements by their composite element terminator character. In this case it’s ‘:’. The composite data element character is also specified in the ISA segment.
Repeating Elements
As of version 5010 X12 there are also Repeating Data Elements. Repeating data elements are used in a segment when the user want to specify more information in a segment by reusing the same data element. Repeating data element can also be used to repeat composite data elements.
EDI parses know that the repeating separator character is by examining the ISA Segment or Interchange Header. For example, a regular segment might look like the following:
DMG*A*2*3~
We can use a Repeating Element for element 1 to be more specific:
DMG*A^B^C^D*1*2~
Take Charge Of EDI