You have two FOR entries, but only one END FOR. The error message means that Patran's looking for the second END FOR, but only finds END FUNCTION instead.
You have two FOR entries, but only one END FOR. The error message means that Patran's looking for the second END FOR, but only finds END FUNCTION instead.