LS Loop Header
To indicate that the next segment begins a loop
The loop ID number given on the transaction set diagram is the value for this data element in segments LS and LE
Following is a figure detailing the use of the LS and LE segments in conjunction.
LS is a control segment. LS is always used in conjunction with a corresponding loop trailer (end) - LE, as illustrated below. The LS and LE indicate the start and end of a loop but are not part of the iteration of the loop.
Loop "A" Header (LS "A") Loop "B" Header (LS "B") Loop "C" Header (LS "C") Loop "C" Trailer (LE "C") Loop "D" Header (LS "D") Loop "D" Trailer (LE "D") Loop "B" Trailer (LE "B") Loop "A" Trailer (LE "A")
Neither LS nor LE is used if the data within the loop is not used.