* July U.S. producer prices rise; industrial output up
* Euro zone agrees to launch bailout for Greece
* Energy stocks decline
* J.C. Penney, Nordstrom rise after results
* Indexes: Dow up 0.4 pct, S&P up 0.4 pct, Nasdaq up 0.3 pct (Updates to close)
By Caroline Valetkevitch
Aug 14 (Reuters) - U.S. stocks ended a volatile week higher on Friday after upbeat U.S. economic data and as euro zone finance ministers agreed to launch a third bailout program for Greece.
All three major indexes also ended the week with slight gains, bouncing back from losses earlier in the week set off by worries over a slowdown in China and a yuan devaluation.
Gains in shares of retailers helped buoy the market. Nordstrom and J.C. Penney both rose after the department store chains posted better-than-expected quarterly results.
Stocks hit session highs late in the session after Belgium's Finance Minister told Reuters in Brussels that euro zone finance ministers had agreed to a Memorandum of Understanding drafted by institutional negotiators, "with some additional measures."
U.S. producer prices rose for a third straight month in July, suggesting the drag on inflation from weaker oil prices was easing, while industrial output advanced at its strongest pace in eight months.
Though the Chinese currency devaluation added some uncertainty to the outlook for a Federal Reserve interest rate hike, most traders and economists are still expecting a September increase.
That kept the market from breaking out of its trading range, said Michael James, managing director of equity trading at Wedbush Securities in Los Angeles.
"I think the bulls are nervous and bears are hoping for a big market decline once the Fed does finally hike rates," he said.
The Dow Jones industrial average rose 69.15 points, or 0.4 percent, to 17,477.4, while the S&P 500 gained 8.15 points, or 0.39 percent, to 2,091.54.
The Nasdaq Composite, which swung 167 points from its low this week to its high, added 14.68 points, or 0.29 percent, to 5,048.24.
For the week, the Dow rose 0.6 percent, the S&P 500 added 0.7 percent and the Nasdaq gained 0.1 percent.
The day's economic data followed strong employment and retail sales data for July on Thursday, which overall suggested the third quarter was off to a healthy start.
Nine of the 10 S&P 500 sectors ended higher.
Energy shares dipped in afternoon trade and the energy index ended down 0.2 percent. Still, the energy index rose 3.2 percent for the week, its biggest gain since March.
J.C. Penney rose 5.6 percent at $8.52, Nordstrom jumped 4.3 percent to $78.13 and was among the biggest percentage gainers in the S&P 500, while the S&P retail index rose 0.4 percent.
Restaurant operator El Pollo Loco fell 20.7 percent to $14.56, below its IPO price, after weak quarterly results.
Sysco rose 7.4 percent to $41.38 after Nelson Peltz reported a 7-percent stake in the food distributor and said he would seek representation on the company's board.
NYSE advancers outnumbered decliners 2,072 to 962; on the Nasdaq, 1,697 issues rose and 1,096 fell.
The S&P 500 posted 21 new 52-week highs and 11 new lows; the Nasdaq recorded 62 new highs and 101 new lows.
About 5.2 billion shares changed hands on U.S. exchanges, below the 7.1 billion daily average for the month to date, according to BATS Global Markets. (Editing by Meredith Mazzilli and Nick Zieminski)