You have used a indicator variable in a statement and that indicator variable has not been declared in a DECLARE SECTION.