Segment repetition in X12 EDI

Sometimes a segment in a transaction set can be repeated. This usually shows up in implementation guides as the Max Use of a segment.

Image of max use segment
  • 1 means that the segment cannot be repeated.
  • >1 means that the segment can be repeated an infinite number of times.
  • Any other number means the segment can be repeated at most that number of times.

The X12 standard defines the repetition for each segment, but your trading partner may deviate from the standard in their implementation guide to suit their business needs. In that case, you should follow the implementation guide.


You’ll see segment repetitions most often when the segment has a qualifier. A qualifier determines the meaning of a segment. For example, the DTM segment contains a date and it uses a qualifier to tell you if it’s a shipping date, a delivery date, a blind date, etc. It often makes sense to have multiple dates, so the DTM segment can be repeated.


In the example above, the first segment is the shipping date and the second segment is the estimated delivery date.

In a situation like this, the implementation guide will often deviate from the X12 standard. The standard may say that the DTM segment can be repeated, say, 300 times, but if your trading partner only accepts a shipping date and an estimated delivery date, they may set a maximum of 2 repetitions.

Multiple qualifiers

In most cases, repeated segments do not use the same qualifier more than once. After all, it wouldn’t make much sense to have a single shipment with multiple shipping dates. However, some segments have multiple qualifiers.

For example, the MEA segment represents a measurement. The first qualifier tells you what kind of measurement you’re dealing with, say a weight. The second qualifier tells you what kind of weight. The following example includes both a gross weight and a net weight.


Repeatable qualifiers

There are also cases where it’s perfectly valid to repeat the same qualifier. For example, a container may have multiple seals. You can use a separate REF segment for each seal and they’ll all have the same qualifier.


Long data

Every segment has a maximum character count and sometimes, you just need more characters! You’ll typically run into this situation with free-form text segments like NTE and MSG. In that case, you can repeat the segment to fit more data.

MSG*Service Terms: The Service Terms below govern your use of the Services. Capitalized terms used in these Service Terms but not defined below are either defined i) in the Stedi Customer Agreement, or ii) in other agreements with us that govern your use of the Servic~
MSG*es (collectively, the “Agreement”). 1. Universal Service Terms (Applicable to all Services) …~

Stedi is a registered trademark of Stedi, Inc. Stedi's EDI Reference is provided for marketing purposes and is free of charge. All names, logos, and brands of third parties listed on our site are trademarks of their respective owners (including “X12”, which is a trademark of X12 Incorporated). Stedi, Inc. and its products and services are not endorsed by, sponsored by, or affiliated with these third parties. Our use of these names, logos, and brands is for identification purposes only, and does not imply any such endorsement, sponsorship, or affiliation.