Dow, S&P higher on support from energy shares even as tech struggles