Three layers in X12

  • ISA / IEA — the interchange envelope. Identifies sender and receiver at the company level, sets delimiters, carries the interchange control number.
  • GS / GE — the functional group envelope. Groups transactions of the same type (e.g. all purchase orders in this interchange).
  • ST / SE — the transaction set envelope. Wraps one business document (one PO, one invoice).

The UN/EDIFACT equivalent

  • UNA — service string advice that declares the delimiter scheme (optional but recommended).
  • UNB / UNZ — interchange header / trailer.
  • UNG / UNE — functional group (optional in EDIFACT).
  • UNH / UNT — message header / trailer.

Control numbers are not optional

Every envelope layer carries a control number. They are how you and your partner reconcile what was sent against what was received, and how acknowledgments (997 for X12, CONTRL for EDIFACT) reference the original document. Reusing a control number is a fast way to confuse a partner's translator.

An envelope you can read

ISA*00*          *00*          *ZZ*SENDERID       *ZZ*RECEIVERID     *240611*1453*U*00401*000000001*0*P*:~
  GS*PO*SENDERID*RECEIVERID*20240611*1453*1*X*004010~
    ST*850*0001~
      ...purchase order body...
    SE*13*0001~
  GE*1*1~
IEA*1*000000001~