1 minute read

The Structure of an ANSI ASC X12 File

ANSI ASC X12 is the second major EDI format standard besides UN/EDIFACT and offers some special features in structure and design. In this article we therefore focus on the segments and elements in the structure of an ANSI X12 file.

For more information on using X12 party identifiers correctly, please see our article “The Most Common ANSI ASC X12 Parties and How to Use Them” on this topic.

Segments as basis in the structure of an ANSI X12 file

EDI files essentially consist of segments that contain the basic information. Every EDI message is created from these segments, as with ANSI ASC X12. For example, if we simply want to send the name of a partner company, we can use the so-called NM1 segment (easy: NM stands for “name”).

Our example segment could now look like this:

your image alt text
Structure of an ANSI X12 file Example of an ANSI X12 segment


Segment Name: Stands for the name of the segment. NM1

Element Separator: For separation before data elements. *

Segment Separator: This determines the end of the segment. ~

Data Element: Specified data. 808, 5, NAME ORGANISATION, XX

Composite element: Several data elements can be grouped into a logical unit. A:B:C

Composite Element Separator: Composite elements can be separated. :

The delimiters for the correct reading (“parsing”) of the data or data elements by the EDI solution are element separator, segment separator and composite element separator. Data elements can, for example, simply be text (such as our example company), numbers, time or date specifications, identifiers, etc. Data elements have a certain minimum and maximum length. For example, text is usually longer than a time specification. EDI parsers can also check the permitted length in the structure of the ANSI X12 file.

The ISA segment in the structure of an ANSI X12 file

At the beginning of an EDI file there is the ISA segment, also called Interchange Control Header. The delimiters or separators mentioned above, which the EDI solution uses to divide and read the segment, are determined here and communicated to the EDI solution.

This works because the ISA segment is defined at exactly 106 characters. This means that the EDI solution can search for the character itself at the corresponding position in the segment:

ISA*00*          *00*          *01*069167604     *ZZ*PLANT-MX       *170614*0808*^*00401*000000003*0*T*:~'

Data Element Separator:
Character No. 4: *

Repetition Element Separator: (for repeating data elements): Character no. 83: ^ (U would stand for “unused” by the way)

Composite Element Separator: Character Nr. 105: :

Segment Separator: Character Nr. 106: ~

When the structure of an ANSI X12 file becomes more complicated

EDI messages can sometimes become very large. To counteract the complexity, two elements were created for ANSI X12:

Composite Elements

Sometimes a single data element is not specific enough for a message. Then a composite element can be used to help. This is defined in the ISA (Interchange Control Header) segment at the very beginning of a complete EDI message, which we will discuss below. In our case it is :. The EDI solution can then recognize such data elements in the composite and distinguish them by the character. 

Recurring elements

With version 5010 X12, repeating data elements (repeating elements) can also be defined. This allows information to be specified more specifically in a segment by using the same data element for more information. This also works with composite data elements. The separator for the EDI solution is again defined in the ISA segment.

For example, we have a CLM segment (CLM stands for “claim”) whose element CLM05 consists of three components: Claim Facility Code Value, Claim Facility Code Qualifier and Claim Frequency Type Code. CLM05 is represented as a composite element with 11:B:1:


This is now, indicated by ^, cemented with a new composite element 12:B:2.

More questions?

If you have questions about ANSI X12 or EDI more generally, please contact us. We are always happy to help!

More information can also be found on the official ANSI ASC X12 homepage is also worth a click.

most read

Keep on reading

5 minute read

Feature Focus: Visibility of EDI Relations Within the ecosio.monitor

Discover how you can simplify and streamline onboarding processes with the help of the ecosio.monitor EDI relations feature.

9 minute read

EDI Invoicing: Common Questions Answered

EDI invoicing is becoming increasingly integral to success. In this article we explore some of the top questions on this topic.

9 minute read

The AS2 EDI Protocol Explained

The AS2 EDI protocol is critical to B2B connections across the world. In this article we explain how it works and what it offers.

7 minute read

EDI Interfaces Explained

Find out how EDI interfaces work, what benefits they bring, and what separates a good EDI interface from a great one!

8 minute read

Common EDI Errors and How to Fix Them

Resolving EDI errors is a crucial part of maintaining automated B2B connections. See the most common issues and how to eliminate them here.

5 minute read

Introducing the new ecosio Monitor

The new ecosio Monitor is up and running. Read our article to see the new features and how it can benefit your business.

7 minute read

Integrating an XML Checker into Your ERP System

What are the benefits of integrating an XML checker into your system and how easy is it to do? Read our article to find out!

3 minute read

EDIFACT PRI Segment - Calculation Net vs. Calculation Gross

The composition of an EDIFACT PRI segment can be confusing. In this article we explain and present the definition of gross and net prices.

8 minute read

Electronic Data Interchange (EDI) with the Help of VDA Standards

Interested in a brief insight of the VDA and the standards it established for data interaction? Click to read our article.

5 minute read

Electronic Data Interchange (EDI) with 3M

3M heavily relies on the use of EDI to automate supply chain processes. In this article, we outline the facts and help you get started.

We use cookies to provide an optimal website experience. You decide which one you want to allow. Depending on the setting, however, not all functionalities may be available to you. Data protection & imprint.