Also, I don't see where you are setting iThisField (used by Set_Attribute). Isn't that needed to tell what field number is to be changed?

Maybe:

Code:
If (nlen eq 50) Begin
    Move 1 to iUpdate
    Move idx to iThisField
End