U.S. stock indexes were on pace at midday for big monthly gains, offering a reprieve for investors after a bruising 2022.