I think the problem is that your subroutines may be setting @error which when you is then used in your loop instead of the @error from the $Line assignment.

Can you try putting the $Line assignment right before your "Loop" statement (right after the ":PCIP")
_________________________
Eric