NOGROUP

501

No GROUP to end

Your code contains an ENDGROUP statement with no matching GROUP statement.