X12 characters

There are three important components found within an X12 document: Segments, Elements, and Loops.

Segments

Each line of an X12 document is a Segment, which starts with the Segment ID and ends with a ~.

Elements

Within each Segment there are multiple Elements, separated by Element separators: *.

There are also Component Element separators > which can be used within Elements to separate sections of the Element.

Loops

Loops are Segments or Elements that are grouped together because they are all related to a similar piece of information.

For example, in an 850 Purchase Order, there is an Address loop, which in this example contains information about:

  • Party Identification in the N1 Segment
  • Party Location in the N3 Segment
  • Geographic Location in the N4 Segment