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

4 minute read

Five Reasons Handling VAN Connections In-house is Unwise

VAN connections can be time consuming and costly if not handled correctly. Find out why an in-house approach might not be for you.

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.

6 minute read

How do I Implement EDI with SAP Cloud Platform Integration?

EDI with SAP Cloud Platform Integration: take over internally yourself or hire a fully managed EDI service provider? In this article we explore the positives and negatives of these approaches.

3 minute read

How to Plan an EDI Project Correctly

Planning an EDI project properly is crucial to the ultimate success of your solution. But what do you need to consider during this stage?

6 minute read

Four Tips to Ensure Your EDI Integration Project is a Success

Approaching an EDI integration project can be a daunting task. By considering these four key points you can increase your chances of success.

2 minute read

How to create an SAP transaction code

Want to know how to create an SAP transaction code for an existing ABAP program so that you can easily call the program?

4 minute read

Supply Chain Automation via EDI - The Four Main Hurdles

Successful supply chain automation is impossible without reliable EDI processes. However, implementing a EDI solution comes with challenges...

5 minute read

Web EDI - What, Why and How?

What is Web EDI and how does it work? Read our article to find out the basics about Web EDI and whether it can benefit your business.

3 minute read

Three Tips to Help You Improve E-invoicing Processes

Three simple things you can do to improve your business's e-invoicing processes and ensure they are reliable and future-proof.

3 minute read

Three Challenges for Web EDI Solutions

Discover the three main challenges that a Web EDI system must overcome to be successful.

Upcoming Webinar - The Secrets of Successful EDI in Microsoft Dynamics 365 Business CentralRegister 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.