Shouldn't
Code:
IF V_Valid := 1 THEN
be
Code:
IF V_Valid = 1 THEN
?