* TSX up 32.22 points, or 0.21 percent, at 15,258.56 * Five of the 10 main index sectors advance * CP Rail shares at record high after results * Loblaw slips after management changes By John Tilak TORONTO, July 17 (Reuters) - Canada's main stock index edged up to a record high on Thursday, boosted by a jump in shares of Canadian Pacific Railway Ltd after the company reported a quarterly profit that beat market expectations. CP Rail climbed 3.6 percent to a record high for the stock after reporting an increase in second-quarter earnings as it worked to recover from backlogs and a harsh winter. Late in the morning it was trading at C$204.60. The market had opened lower on concerns about the implications of a wave of sanctions that Western powers imposed on Russia. Also working into the mix were figures that showed the number of Americans filing new claims for unemployment benefits fell unexpectedly last week. But U.S. data also showed a drop in housing starts and building permits last month. The Canadian benchmark index has gained about 12 percent this year, driven by a rally in shares of oil and gas companies and gold miners. "Our view is that it's time for investors to be quite cautious," said Michael Sprung, president of Sprung Investment Management. "I would suggest it doesn't hurt to take some profits off the table and have some cash on the sidelines, should there be a bit of a market setback." But he noted that stocks were still more attractive than bonds: "Even though equities are quite expensive, on a relative basis they're the only game in town." The Toronto Stock Exchange's S&P/TSX composite index was up 32.22 points, or 0.21 percent, at 15,258.56, after touching a record high of 15,269.39 earlier in the session. The gold-mining sector climbed with the bullion price. Goldcorp Inc rose 1.4 percent to C$29.83, and Barrick Gold Corp added 0.7 percent to C$20.42. Shares of energy producers advanced 0.3 percent as they benefited from a higher U.S. crude oil price. Canadian Natural Resources Ltd was up 0.3 percent at C$48.28. Loblaw Cos Ltd named Executive Chairman Galen Weston president of the grocery chain, replacing Vicente Trius. The stock fell 0.9 percent to C$48.84. ($1=$1.07 Canadian) (Editing by Peter Galloway)