The UNA segment: delimiters are not always the same

· If a file opens with UNA, forget the defaults — that line says which character does what.

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:

PositionCharacterRole
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

characters long

When the first three letters of a file are UNA, that is where to look before your parsing logic runs at all.

Related reference

UNB

← All posts