X12 998 — Set Cancellation
The 998 cancels a previously transmitted transaction set — a structured, explicit cancel hook before the application processes the original message.
Purpose
The 998 documents the controlled cancellation of a transaction set previously sent on the same partnership — for example, withdrawing an 850 sent by mistake before the ERP triggers production. It carries the identifier of the set to cancel (ISA / GS / ST / control numbers), the reason and the scope (plain cancel, or cancel-and-replace by a new set).
It is used on critical non-EDIFACT flows (retail order, 837 healthcare entered twice, 850 mis-routed) where the absence of a clean cancel would force a manual workflow. Acknowledged by 997 and ideally delivered before the targeted transaction is processed, otherwise it becomes inert and a 860 (Change Request) or business workflow has to take over.
Envelope structure
The 998 travels within the three X12 envelope levels (ISA/IEA,
GS/GE with functional group CN, and ST/SE).
Didactic example in release 004010:
ISA*00* *00* *ZZ*ACMERETAIL *ZZ*ACMEVENDOR *260514*1900*U*00401*000000998*0*P*>~
GS*CN*ACMERETAIL*ACMEVENDOR*20260514*1900*1*X*004010~
ST*998*0001~
ZD*850*ACMERETAIL*ACMEVENDOR*20260514*1430*000000123*0001*CA~
SE*3*0001~
GE*1*1~
IEA*1*000000998~ Common segments
- Header —
ST(998) on the originating sender / receiver partnership. - Reference to cancel —
ZD(Beginning Segment for Set Cancellation): Transaction Set Identifier Code of the targeted message, sender / receiver IDs, date, ICN (ISA13), Group Control (GS06), Transaction Set Control Number (ST02), action code (CA = Cancel, CR = Cancel & Replace). - Summary —
SE.
Common pitfalls
- Too late to cancel: if the receiving application has already processed the targeted transaction, the 998 is inert — fall back to a 860 (Change Request) or business cancellation workflow. The 998 does not rewrite anything.
- Wrong ICN: a 998 pointing at the wrong ISA13 cancels an arbitrary set or nothing at all; verify
ZD06(ICN) before sending. - Cancel & Replace:
CRrequires a fresh complete set transmitted in the same interchange or referenced; otherwise the receiver is left without a transaction and the order is lost.
Related transactions
Documentation
The code 998 and the name Set Cancellation are public and listed on x12.org/products/transaction-sets. The complete structure of loops, qualifiers and code lists is distributed by DISA via the proprietary Implementation Guides (TR3). ediverse.io covers only public concepts, the envelope and didactic examples.