TRADACOMS Parser
Decode a TRADACOMS interchange (GS1 UK) segment by segment, 100% client-side. ORDHDR, ORDERS, INVFIL, INVOIC, DLHEAD, SLSRPT — STX/MHD/MTR/END walk, counter cross-checks.
Paste a TRADACOMS interchange (STX first) to parse it.
How it works
TRADACOMS is the UK EDI standard developed in 1982 by the ANA (Article
Number Association, now GS1 UK). It is still the dominant format in UK
retail — Tesco, Sainsbury's, Asda, M&S and Morrisons all use it daily,
even in 2026. The format is flat: each line is an ASCII segment of the
form TAG=element1+element2+…, terminated by an apostrophe
'. Composite element components are separated by
:. A release character ? escapes the next byte.
The parser tokenises the interchange while honouring the release character, then extracts:
- STX — Start of Transmission (file header): application authority, sender, recipient, date/time, interchange reference.
-
A sequence of messages delimited by
MHD(Message Head) andMTR(Message Trailer), with the segment count carried in the MTR. - END — End of Transmission, with the segment count for the entire file.
Interchange structure
STX=ANAA:1+5012345000004:LEEDS+5012345678907:HEAD OFFICE+260518:113000+12345'
MHD=1+INVFIL:9'
TYP=0700+DETAILED INVOICES'
SDT=5012345678907:LEEDS+1234'
CDT=5012345000004:HEAD OFFICE'
FIL=12345+1+260518'
MTR=6'
MHD=2+INVOIC:9'
CLO=5012345000004:HEAD OFFICE'
IRF=INV00001+260518'
ILD=1+5012345678907:EAN+12+EA+CASE+1500+18000'
STL=1+1+18000+3600+21600'
TLR=21600+3600+18000'
MTR=7'
END=15' Common messages
The parser ships metadata for the six most-used types in practice:
- ORDHDR — Order Header. File header accompanying one or more ORDERS messages.
- ORDERS — Purchase Order. Order lines (OLD — Order Line Detail) with quantity, EAN/GTIN, agreed price and delivery date.
- INVFIL — Invoice File. File header accompanying one or more INVOIC messages.
- INVOIC — Invoice. Note: same 6-letter type id as EDIFACT INVOIC but a completely different segment structure. Invoice line (ILD), VAT sub-totals (STL), totals (TLR).
- DLHEAD — Delivery Head, header for delivery messages (DELHDR / DELDET — Delivery Header / Detail).
- SLSRPT — Sales Report. Periodic statement from a retailer to a supplier listing units sold per SKU per delivery point. Heavily used by UK grocery for vendor-managed inventory.
Delimiters and escapes
Delimiters in TRADACOMS are fixed:
- Segment terminator:
'(apostrophe). - Element separator:
+. - Component separator:
:. -
Release character (escape):
?. Prefix a delimiter to make it literal:?+≡+,?:≡:,?'≡',??≡?. - Decimal mark:
.(dot).
Limits
- The parser does not validate the syntax of amounts, dates or EAN/GTIN codes inside elements. Only the envelope structure is checked.
- The mandatory segment lists displayed per message type are indicative: the GS1 UK Manual v9 has gone through several UPDATEs (through 2013) and some operators use proprietary variants.
- TRADACOMS has dozens of other messages (PIIH, GENRAL, PRDTRA, UTLBIL, COREOR…) that this parser tokenises correctly but without dedicated metadata.
- Transport via VAN or FTP, AS2 wrapping and compression controls are out of scope: the parser starts from the plain-text content.