Nesting Rules



This WebPage has been visited Hit Counter times since 3/24/98


Nesting Rules

There are times when a segment must be nested within another segment. The nesting rules are

  • No segment may have itself nested immediately under it.
  • The repeat factor for a segment at nest level 0 specifies the maximum number of times a segment may appear in the entire message. For segments with a nesting level of more than 0, the repeat factor specifies the maximum number of times the segment may appear under its parent segment.
  • If a nested segment is omitted, all segments nested under it must also be omitted.
  • When changing levels, the nesting level may only increase by 1. It may decrease by any amount.
  • When a nested segment is listed as mandatory, it must appear at least once under its parent segment if, and only if, the parent segment appears in the message.


Nested Segment

Traditionally, a nested segment might look as follows

Message A

Segment 1 Nest level 0

Element 1

Element 2

Element 3

Segment 2 Nest Level 1

Element A

Element B

Element C

End of Segment

Element 4

Element 5

End of Message