I suspect that the error is in the line before '$Segment = Split($Line, "*")', namely 'IF SUBSTR($Line, 1, 3) = "SDQ"', and that $Line is empty when that particular error occurs.
_________________________
There are two types of vessels, submarines and targets.