Skip to main content

Introduction to X12

This page briefly introduces the X12 standard and InterSystems IRIS® data platform support for X12.

The American National Standards Institute (ANSI) founded the Accredited Standards Committee (ASC) X12 as a cross-industry forum to build and support electronic data exchange standards, related documents and products intended for worldwide use. Thus, X12 is the ANSI standard for Electronic Data Interchange (EDI). There are more than 300 document types defined. No X12 document type is excluded from InterSystems IRIS support, but most of the focus at InterSystems has been on the documents related to the Health Insurance Portability and Accountability Act (HIPAA).

The Structure of X12 Envelopes

The rules for X12 envelope structure ensure the integrity of the data and the efficiency of the information exchange. The actual X12 message structure has primary levels that are hierarchical. From highest to the lowest, they are:

  • Interchange Envelope

  • Functional Group

  • Transaction Set

X12 envelope structure, which includes one interchange, two functional groups, and three transaction sets

X12 and HIPAA

Title II of HIPAA, the Administrative Simplification (AS) provisions, requires the establishment of national standards for electronic healthcare transactions and national identifiers for providers, health insurance plans, and employers. The AS provisions also address the security and privacy of health data. The standards are meant to improve the efficiency and effectiveness of the healthcare system in the United States by encouraging the widespread use of electronic data interchange in the US healthcare system.

Among the X12 documents that specifically support HIPAA are:

  • 270_X092: Eligibility, Coverage or Benefit Inquiry

  • 271_X092: Eligibility, Coverage or Benefit Information

  • 276_X093: Healthcare Claim Status Request

  • 277_X093: Healthcare Claim Status Notification

  • 278_X094Request: Healthcare Service Review (Request)

  • 278_X094Response: Healthcare Service Review (Response)

  • 820_X061: Payment Order/Remittance Advice

  • 834_X095: Benefit Enrollment and Maintenance

  • 835_X091: Healthcare Claim Payment/Advice

  • 837_X096: Healthcare Claim: Institutional

  • 837_X097: Healthcare Claim: Dental

  • 837_X098: Healthcare Claim: Professional

InterSystems IRIS comes prepackaged with HIPAA 4010 and HIPAA 5010 Schemas installed. HIPAA 5010 provides additional documents for health insurance exchange including 277CA, 820hix, 837apD, 837apI, 837apP, and 999.

X12 Schema Distribution Files

The X12 Standards describe in detail the syntax and semantics of documents. These descriptions are available as PDF files from the official publisher, Washington Publishing Company:

http://www.wpc-edi.comOpens in a new tab

While informative, the documents are not intended to be machine readable. Machine-readable X12 schemas are available as SEF or XSD files. An SEF file encodes the syntax and much of the semantics of an EDI document. For example, not only does it specify the size and types of fields and any code values which may be applicable, but it also defines dependencies between fields and dependencies between segments within documents. The SEF standard was developed by Foresight Corporation to encode any EDI specification (not just X12) and put into the public domain. You can download a printable version of the standard form: in a new tab

This information is worth examining, as it gives you an idea of the scope and complexity of EDI. Many organizations have encoded various EDI standards and made them available to the public. In addition, the United States Department of Defense has published many SEF files for their acquisition systems.

The information in the XSD files is mostly the same as in the SEF files, with several notable omissions:

  • XSD files are also missing segment position, which is a concept that is also present in the Implementation Guides, but has no impact on InterSystems IRIS processing of the documents.

  • Furthermore, XSD files are also missing the segment ordinals, which are actually necessary for identifying a particular occurrence of a segment in the validation-style schema representation. However, ordinal values do not appear in the Implementation Guide, and the default is for them to increment by 1 (only appear in the SEF file when it doesn't follow this pattern), so sticking to the default of incrementing the ordinal by 1 between each segment makes it possible to process documents correctly and does not inaccurately represent the schema.

  • Finally, XSD files do not include relational conditions.

InterSystems IRIS Support for X12 Documents

InterSystems IRIS stores X12 documents as a type of InterSystems IRIS object called a virtual document to enable faster processing. Specifically, an X12 document is stored as an EnsLib.EDI.X12.DocumentOpens in a new tab where each segment of the X12 document is stored as an EnsLib.EDI.X12.SegmentOpens in a new tab. X12 Interchanges are also stored as an EnsLib.EDI.X12.DocumentOpens in a new tab with pointers to the other X12 documents contained within. Segments and Elements of a Transaction Set are reached by using a virtual property path. For example, the identifier code of a given Transaction Set would be accessed by virtual property path “ST:TransactionSetIdentifierCode”. See Parsing the Document for more information.

InterSystems IRIS provides tools so that you can access values in virtual documents for use in data transformations, business rules, and searching and filtering messages. For background information, see Using Virtual Documents in Productions.

InterSystems IRIS provides tools so that you can access values in virtual documents for use in data transformations, business rules, and searching and filtering messages. See Using Virtual Documents in Productions.


In the unlikely event that you wish to clone an X12 batched virtual document, call %ConstructClone(1), passing 1 as the value of the deep parameter to create a deep clone, ensuring that both the parent object and any child objects are cloned.

See Also

FeedbackOpens in a new tab