Rory McIlroy remains positive ahead of The Open and says he has learnt lessons from his agonising defeat in the US Open.