The UNA segment: delimiters are not always the same
The first assumption every EDIFACT parser makes is that the segment terminator is ', the element separator + and the component separator :. True for most files — but not guaranteed.
What UNA does
If a file opens with UNA, that line defines the delimiters:
UNA:+.? '
Each of the six characters sets one role:
| Position | Character | Role |
|---|---|---|
| 1 | : | Component separator |
| 2 | + | Element separator |
| 3 | . | Decimal mark |
| 4 | ? | Release (escape) character |
| 5 | (space) | Reserved, unused |
| 6 | ' | Segment terminator |
|---|
The example above restates the defaults, so it changes nothing visually. But this is equally valid:
UNA|*.? ~
Here the element separator is * and the terminator ~. A parser written to the defaults reads that file as one enormous segment.
The decimal mark
The third character is often overlooked. In some countries the decimal separator is a comma:
UNA:+,? '
In that file, the value in PRI+AAA:1,85' is one point eight five, not one and a half. Mistaking the comma for a thousands separator and reading 185 inflates the invoice a hundredfold.
What to do in practice
- If the file starts with
UNA, read the delimiters from it; do not assume - With no
UNA, the defaults apply - The
UNAline never ends with a segment terminator; it is exactly six
characters long
When the first three letters of a file are UNA, that is where to look before your parsing logic runs at all.