There is insufficient information in your post to answer your questions, but one can make a guess:
An IMPLICIT NONE declaration applies only to the program unit (main program, subroutine or function) in which it is contained. It does not apply to any other program unit, even in the same source file.
Without IMPLICIT NONE, default variable typing makes ANS a real variable, and that explains the error message that you received.
The compiler option -Mdclchk may be used to locate implicitly typed variables.
The Fortran 77 and 9X standards do not allow comparing a character expression to a noncharacter expression. The PGI F77 compiler does not flag such a comparison unless the -Mstandard compiler option is used.