4 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.

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/span>*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

8 minute read

Peppol Acknowledgements, Message Level Responses and Business Level Responses - A Helpful Guide

Peppol acknowledgements, message level responses and business level responses are a key part of what makes Peppol such an attractive prospect for modern B2B data exchange. Find out how they...

7 minute read

Sending Electronic Invoices in Spain Using the FacturaE Format via the FACeB2B System

We present the status of e-Invoicing in Spain and give an outlook on the future implications if the current regulation will be extended to all companies in Spain.

10 minute read

Alternative Solutions for EDI Data Exchange with SAP PI

Many companies use SAP PI to enable data exchange between a given SAP ERP system and its connecting systems. Discover the options available.

5 minute read

What is Master Data and Why Does it Matter?

Efficient master data is crucial to successful EDI processes and a streamlined supply chain. Find what you can do to improve yours.

7 minute read

E-invoicing in Poland

Big changes are planned for e-invoicing in Poland over the next few years. Find out what's ahead and how long you have to implement changes.

5 minute read

E-invoicing in Spain

What are the regulations when it comes to e-invoicing in Spain? Find out what's required and what changes are likely in the future.

5 minute read

E-invoicing in France

Is e-invoicing in France mandatory? Read our article to find out what you need to do to achieve compliance and prepare for the future.

8 minute read

An Introduction to the Four Main EDI Methods

Do you know which of the main EDI methods makes most sense for your business? To help, in this article we break each method down one by one.

20 minute read

The Future of EDI

Debunking the myths and building a realistic picture of what the next decade will bring for B2B integration.

5 minute read

Why an API Connection is Key to a Streamlined EDI System

Discover how your business could improve EDI processes through the use of an API connection to your EDI service provider.

Upcoming Webinar - 10 Ways to Optimise Your EDI Processes (and 5 Mistakes to Avoid)Register Now!

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.