Have you changed this line during your refactoring? Is CARD2
supposed to be an array of strings, or an array single characters?
A few answers in your other thread (Error: Rank mismatch in argument 'std' at (1) (scalar and rank-1)) have alluded to this, but without more information it’s difficult to know what you want to achieve, hence you continue wasting everyone’s time.
FWIW, if you just want to make a compilation error go away, do this
IF (CARD1(1:1).EQ.'K') THEN
IF (ANY(CARD2(1:2).EQ.' '))THEN
It’s a minor change (five extra characters), and should make the program compile. Does it do what you want? Probably not…