ANSI X12 Explained: Message Standards and Transaction Sets

EDI has been the backbone of B2B transactions since the 1970s. However, many businesses still struggle to translate EDI standards from one standard to another. 

Although only one of many EDI standards, the American National Standards Institute X12 (ANSI X12) is dominant in North America and used across the globe1. ANSI X12 is critical to understand and integrate into your EDI system.  

Here, we will explain ANSI X12 transaction sets (T-Sets), syntax and message construction to provide you with the practical information you need to navigate the ANSI X12 standard with confidence.

What is ANSI X12?

The American National Standards Institute X12, known as ANSI X12, is an EDI standard introduced by The Accredited Standards Committee (ASC) in 1979. 

The principle behind the ANSI X12 format is the same as all EDI standards: create a common language of codes and segments that can represent a wide range of business transactions across various industries. This provides uniformity for inter-industry electronic exchange of business documents in order to streamline transactions between trading partners. 

ANSI X12 subcommittees

To handle the breadth of business processes covered by ANSI X12, the Accredited Standards Committee established subcommittees for different industry sectors. These include:

  • X12C – Communications & Controls
  • X12F – Finance
  • X12I – Transportation
  • X12J – Technical Assessment
  • X12M – Supply Chain
  • X12N – Insurance

These subcommittees cater to the unique requirements of different sectors, providing specific subsets of ANSI X12 for more precise communication.

Components of an ANSI X12 message

An ANSI X12 message is a structured set of data that represents a specific type of business transaction. Each message is built using a unique arrangement of codes, segments, and transaction sets (T-sets), which are unique but overlapping concepts.

  • ANSI X12 Codes: These are unique identifiers that represent specific T-sets segments, or data elements in a message.
  • ANSI X12 Segments: These are collections of related data elements that represent specific pieces of information in a transaction set. Each segment starts with a unique Segment ID, followed by the data elements separated by element separators.
  • ANSI X12 T-sets: These are groups of related data segments that make up a particular business document or transaction. Each transaction set represents a different type of business document, such as an invoice or purchase order.

In ANSI X12, specifically, the terms T-set and message are often used interchangeably, and both refer to a collection of data that represents a single business document or transaction. However, T-sets can be defined more specifically as the type of business transaction that the message represents, while the message is the full representation of that business transaction. 

ANSI X12 Code List

ANSI X12 has a wide range of codes used to denote specific message types that you need to understand in order to effectively construct an ANSI X12 message. The most common ANSI X12 codes are:

ANSI X12 CodeDescription
820Payment Order
830Delivery Forecast
832Price/Sales Catalogue
840Request for Quotation
846Inventory Inquiry/Advice
850Purchase Order
852Product Activity Data
855Purchase Order Acknowledgement
856Ship Notice/Manifest
860Purchase Order Change Request
865Purchase Order Change Acknowledgement
870Order Status Report
997Functional Acknowledgement
Note: There are many more codes within the ANSI X12 format, each designed to facilitate a specific type of transaction or communication.

How ANSI X12 Messages are constructed

Constructing an ANSI X12 message entails assembling different key components in a structured, hierarchical manner using specific syntax. The components include data elements, segments, and transaction sets (T-sets), all of which are encapsulated within envelopes that structure the message. Here, we will dissect each component and illustrate their assembly into an ANSI X12 message.

Usable Characters: The language

Just like any language, ANSI X12 has a specific set of characters that can be used within messages. These include:

  • Alphabetic characters: A to Z (uppercase only)
  • Numeric characters: 0 to 9
  • Special characters: A set of special characters, such as . , – ( ) / = + : ? ‘ and spaces

Together, these provide flexibility for communicating a full range of business transactions and information.

Data Elements: The fundamental units

Data elements are the smallest units of data in an ANSI X12 message. They represent individual pieces of business information. Data elements can be simple or composite:

  • Simple Data Elements: These contain a single piece of information, akin to a word in a sentence. For instance, the price of a product or a specific date can be a simple data element.
  • Composite Data Elements: These comprise multiple related pieces of information, similar to a sentence made up of related words. A complete address, which includes street name, city, state, and ZIP code, is an example of a composite data element.

There’s a unique ID for each data element along with its name, description, type, and minimum/maximum length. Data elements follow specific formats or types, such as decimal, integer, identifier, string, or date/time. The data dictionary will also list any restrictions or rules for the data element, such as whether it’s mandatory or optional, and if there are predefined values that it must adhere to.2

Segments: The building blocks

Segments in ANSI X12 are akin to sentences that offer a specific piece of information. Segments are an organised group of related data elements, with each segment beginning with a Segment ID.

Here’s an example:

Segment IDElement SeparatorData Element 1Element SeparatorData Element 2

This ‘BEG’ (Beginning Segment) indicates the start of a purchase order, with ’00’ denoting an original document and ‘082922’ representing the purchase order number.

Crafting transaction sets (T-Set)

Transaction sets (T-sets) are akin to paragraphs, assembling related segments to represent a complete business transaction. Each transaction set is identified by a unique three-digit code.

Let’s construct a simplified example of a Purchase Order (PO) transaction set (identified by the code 850 in ANSI X12):

Segment IDData Elements
STTransaction Set Identifier Code, Transaction Set Control Number
BEGTransaction Set Purpose Code, Purchase Order Number
CURCurrency Code
REFReference Identification Qualifier, Reference Identification
DTBDate/Time Reference
SENumber of Included Segments, Transaction Set Control Number

In this example, the ‘ST’ segment starts the transaction set, followed by segments like ‘BEG’ (beginning of the purchase order), ‘CUR’ (currency), and ‘REF’ (reference identification). This T-set ends with the ‘SE’ segment that includes the count of the total number of segments in the transaction set.

Envelopes: Grouping and structuring

Envelopes are the wrappers in an ANSI X12 interchange that group related data and structure the transaction sets. There are three types of envelopes:

  1. The Interchange Control Envelope (ISA and IEA) encapsulates the entire transmission, including all functional groups sent from a sender to a receiver.
  2. The Functional Group Envelope (GS and GE) groups related transaction sets. Different functional groups can be used to group different types of transaction sets or to separate transaction sets meant for different departments within the receiving organisation.
  3. The Transaction Set Envelope (ST and SE) encloses a single transaction set.

Complete Message: Pulling it all together

Let’s put it all together and look at a simplified representation of a complete ANSI X12 for a Purchase Order (850 Transaction Set) message:

Segment CodeData ElementDescription
ISAInterchange Sender/Receiver ID, Date, Time, etc.Interchange Control Header (marks the start of the interchange envelope)
GSFunctional Identifier Code (PO), Sender’s Code, Receiver’s Code, Date, TimeFunctional Group Header (marks the start of the functional group)
ST850Transaction Set Header (marks the start of the transaction set, 850 represents a Purchase Order)
BEG00, 082922Beginning of the Purchase Order (00 stands for Original, and 082922 is the Purchase Order Number)
CURUSDCurrency Segment indicating USD (USD stands for U.S. Dollar)
REFAB, 12345Reference Segment with Additional Buyer Information (AB stands for Additional Buyer’s Number, and 12345 is the Reference Identification)
DTM003, 20210910Date/Time Reference indicating the date (003 stands for Delivery Requested, and 20210910 is the date)
SE5, 0001Transaction Set Trailer (marks the end of the transaction set, and 5 indicates the Number of Included Segments)
GE1, 000000001Functional Group Trailer (marks the end of the functional group, and 1 represents the Number of Transaction Sets Included)
IEA1, 000000001Interchange Control Trailer (marks the end of the interchange envelope, and 1 represents the Number of Included Functional Groups)

In a real EDI message, this information would be formulated like this: 

ISA00 00 ZZSENDERISA ZZRECEIVERISA2012091719U004010000000010P>~

In this instance, the * character is the data element separator, and the ~ character is the segment terminator, following common conventions in X12 syntax. Your specific implementation might use different characters as separators or terminators.

Transmission Files: Groups of messages 

A transmission file in ANSI X12 refers to the entire collection of data that is sent from one trading partner to another at a given time. It’s essentially a batch of business documents structured according to the ANSI X12 standard. A transmission file could contain just a single message (like a single invoice or order), or it could contain many different messages. The key is that all the messages are transmitted together as a unit.

Leverage the strength of an EDI partner

ANSI X12 standard is a powerful and comprehensive system. However, it’s time-consuming to master, particularly for small to medium-sized businesses managing complex supply chains and multiple EDI standards. The challenge of accurately translating EDI formats like EDIFACT or TRADACOMS into ANSI X12, or vice versa, is significant without the right tools or assistance.

EDI via VAN (Value-Added Network) is a private network able to host tools like EDI mapping software that automate the translation of EDI messages from one standard to another. This is a critical capability for any business looking to flexibly engage with supply chain partners operating different, or multiple, EDI standards. 

At Data Interchange, we provide flexible EDI services tailored to your business requirements. While it’s certainly possible to manually translate EDI message formats, we enable businesses to do so at speed and scale. With the right EDI partner it’s possible to be confident in your ability to match the requirements of supply chain partners. Get in touch to learn more. 

1 About X12

2 ANSI/NISO Z39.87-2006 (R2017) Data Dictionary – Technical Metadata for Digital Still Images

Transform your approach to supply chain management

Talk to an Expert

    Epicor values your privacy. Website terms and conditions.


    ANSI X12 EDI 865 T-Set: Structure, Benefits & Use Cases

    The VDA 4987 Message: Structure, Benefits & Use Cases

    ANSI X12 EDI 850 T-Set: Structure, Benefits & Use Cases

    The VDA 4938 Message: Structure, Benefits & Use Cases

    The EDIFACT DELJIT T-Set: Structure, Benefits & Use Cases

    The EDIFACT DELFOR T-Set: Structure, Benefits & Use Cases

    The VDA 4915 Message Explained

    The VDA 4905 Message Explained

    T-Sets | ANSI X12 810

    How to optimise your EDI and ERP system integration

    T-Sets | ANSI X12 997



    Exploring Cloud EDI Services in ERP: Architecture, Security, and Scalability

    VDA Explained: Message Standards and Transaction Sets

    EDIFACT Explained: Message Standards and Transaction Sets

    The Power of Web EDI for Global Supply Chains

    How to Get the Most Out of AS2

    How EDI Simplifies Transactions in the Manufacturing Sector

    Why Your Automotive Supply Chain Needs an OFTP2 Connection

    Digital Supply Chain Trends Impacting 2023 and Beyond

    How to Manage Global Supply Chain Complexities

    How to Overcome Supply Chain Risk

    What is the Future of Supply Chain Management in 2023?

    How to Improve your Supply Chain Strategy

    Why Scalable EDI is Integral to Rapid Business Growth

    How to Pick the Right EDI File Transfer Protocol

    An Introduction to OFTP2 (Odette File Transfer Protocol)

    What are the Costs of EDI Implementation?

    What is PEPPOL?

    A Guide to EDI Protocols

    EDI VAN Costs: Get the Right Solution for your Business

    How Much Does EDI Cost?

    How Do On-Premise EDI Solutions Work?

    Our Plan at Data Interchange to Change EDI and Supply Chain Management

    Integrating EDI with your ERP

    In-house vs Managed Service EDI

    What is an API Integration? And how does it affect EDI?

    Epicor Acquires EDI Provider Data Interchange

    6 Benefits of EDI in the Logistics Industry

    4 Challenges Facing the Logistics Industry and How to Overcome Them

    Top EDI Solution Providers in 2023

    Solving Supply Chain Problems in the Logistics Industry

    B2B EDI Integration Best Practices in 2023

    How to Choose The Right EDI Provider in 2022

    Supply Chain Analytics Trends in 2022

    Future-proof your business: Take Advantage of Market Growth

    Announcement: Andrew Filby becomes CEO of Data Interchange

    7 Advantages of EDI in The Automotive Industry

    Consumer Expectations cause Demand for Integrated Data

    How to Optimise Your Automotive Supply Chain Processes

    Post-Pandemic Supply Chain Challenges Increase the Pressure

    EDI Made Simple for the Automotive Industry

    Overcoming Supply Chain Visibility Issues in the Automotive Industry

    Complex Supply Chain Problems and Simple Solutions

    Supply Chain Flexibility: Why your customers need it

    5 Automotive Supply Chain Challenges Facing the Industry

    Supplier Performance Management Reimagined in 2023

    How to Unite Emerging Supply Chain Management Technology Trends

    Meet the Team: Marketing

    Supplier Management Best Practices after COVID-19

    The Future of EDI: Looking Beyond 2025

    The top three supply chain data exchange requirements

    The Advantages of EDI in E-Commerce: How to Gain a Competitive Advantage Online in 2021

    A Crash Course on EDI Industry Standards: ANSI x12 vs EDIFACT vs OFTP and more

    What is EDI Mapping?

    What is EDI: The History and Future of Electronic Data Interchange

    The Future of the Automotive Supply Chain

    Supplier Relationship Management: How to reduce risk and improve performance

    How EDI-as-a-Service Changes Supply Chain Best Practices in 2021

    Agile Supplier Onboarding: Supply Chain Security in Uncertain Times

    The impact of failed EDI on Supply Chain

    Cloud-Based EDI Solutions vs On-Premise

    Different Types of EDI Compared

    5 Most Common EDI Implementation Issues and How to Solve Them

    Are your EDI documents ready for the new EU/UK customs border?

    B2B Integration Challenges

    EDI vs API: Bridge the B2B connectivity gap

    Ten things to look for in an EDI Managed Service Provider

    World Mental Health Day 2020

    Logicalis & Data Interchange – partnering for success

    EDI – A data integration service critical to business success

    Joining forces with SnapLogic: bringing together market leading iPaaS and EDI solutions

    Joining Data Interchange: My lockdown experience

    Data Interchange announces strategic partnership with SmarterPay

    Access new trading partners quickly for COVID-19 support

    Keeping supply chains moving

    Our Web EDI solution gets a makeover

    Coronavirus: Our Business Continuity Plan

    With love from Data Interchange ♥

    A new decade, renewed ambition and the next generation

    Brexit and EDI

    Data Interchange transform their Support service for an improved customer experience

    Interview: An update on Data Interchange’s new CEO, Robert Steiner

    Data Interchange appoints Robert Steiner as new CEO

    MQ messages over ENX – Renault

    Five key questions for your EDI provider

    Data Interchange at the Odette Conference 2018

    How to select the right EDI provider

    Future proof your EDI and unleash growth

    EDI: the Supply chain performance enhancer

    Taking cost out of the chain

    Non-EDI users held up in the mail

    Over 41% of companies at risk without EDI

    ​Consolidating VAN providers

    Increase visibility and productivity of supply chain logistics with Data Interchange’s B2B integration solutions

    Data Interchange wins large business of the year award

    Data Interchange launch new Support Portal

    Data Interchange will be showcasing our EDI solution offerings and promoting the benefits of MMOG/LE

    Metaldyne receive special recognition from Ford for 11th consecutive year

    Making the move to cloud based EDI Solutions

    Top 5 reasons to switch to EDI Managed Services

    Data Interchange to power QAD Managed EDI On Demand