I don't understand why you need a DO...WHILE loop inside your IF ?
Compare input string and do what you need to.