Sun B2B Suite ASC X12 Protocol Manager User's Guide

Elements of X12 Envelopes

The X12 messages are all in ASCII text, with the single exception that the BIN segment is binary. Each X12 message is made up of a combination of the following elements:

Elements are separated by delimiters. The remainder of this section explains these elements.


The data element is the smallest named unit of information in the X12 standard. Data elements can be broken down into types. The distinction between the types is strictly a matter of how they are used. The types are:

Each data element has a unique reference number, and it also has a name, description, data type, and minimum and maximum length.


A segment is a logical grouping of data elements. In X12, the same segment can be used for different purposes. This means that a field’s meaning can change based on the segment. For example:

For more information on the X12 enveloping segments, refer to Structure of X12 Envelopes.


Loops are sets of repeating ordered segments. In X12 you can locate elements by specifying:


In an X12 message, the various delimiters are part of the syntax, dividing up the different elements of a message. The delimiters used in a message are defined in the interchange control header, the outermost layer enveloping the message.

For this reason, there is flexibility in the delimiters that are used. No suggested delimiters are recommended as part of the X12 standards, but the industry-specific implementation guides do have recommended delimiters.

The default delimiters used by the X12 OTD Library are the same as those recommended by the industry-specific implementation guides. The default delimiters in the X12 OTD Library are:

Segment terminator

~ (tilde)

Data element separator

* (asterisk)

Subelement (component) separator

: (colon)

Repetition separator (version 4020 and later)

+ (plus sign)

Within eXchange, delimiters are specified at the enveloping level. The delimiters defined for an envelope apply to all transactions in the same business service (a predefined dialog between the two parties).

Note –

It is important to note that errors could result if the transmitted data includes any of the characters that have been defined as delimiters. Specifically, the existence of asterisks within transmitted application data is a known issue in X12 and can cause problems with translation.

See Element Separator for information on the ePM delimiter parameter.