Sometimes a segment in a transaction set can be repeated. This usually shows up in implementation guides as the Max Use of a 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.

Qualifiers

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.

DTM*011*20220921~
DTM*017*20220922~

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.

MEA*WT*G*1023*LB~
MEA*WT*N*1000*LB~

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.

REF*SN*A999001~
REF*SN*A999002~
REF*SN*A999003~

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) …~