Wall Street waffled through an erratic session Wednesday, closing mixed as investors nervously watched oil prices but also allowed themselves to be encouraged by good economic news.

Stocks moved in the opposite direction from oil prices for much of the day, declining until early afternoon as crude climbed to $44.34 a barrel on the New York Mercantile Exchange. As oil fell below $43 on the way to a $42.83 close, Wall Street managed a late-session rally -- but that advance quickly fizzled.

Still, the market's tone kept analysts and traders optimistic about the market's long-term prospects, though many cautioned that the typical summer doldrums would likely prevent a major rally this month.

"Yes, we have oil prices rising, but I think overall we're starting to see some settling down in the market," said Bill Groenveld, head trader for vFinance Investments. "All the unknowns that drove the market down in July are starting to pan themselves out."

Stocks also received a boost from two key economic reports. Factory orders rose 0.7 percent in June, more than Wall Street expected. And the Institute of Supply Management's service sector index for June rose more than economists had forecast.

The Dow Jones industrial average rose 6.27, or 0.1 percent, to 10,126.51. Broader benchmarks were narrowly lower. The Standard & Poor's 500-stock index fell 1.06, or 0.1 percent, to 1098.63, and the Nasdaq composite index dropped 4.36, or 0.2 percent, to 1855.06.

A key test for the economy and the markets will come Friday as the government releases the latest data on job creation. Tuesday's Federal Reserve meeting will also be closely watched for signs about action on interest rates.

In the meantime, technology shared suffered as telecom company Ciena warned that sales would slump significantly in the third quarter. Ciena fell 68 cents, or almost 25 percent, to $2.08.

Prudential Financial, whose headquarters was named in this week's terror alert as a possible target, gained 60 cents, to $46.36, as it reported a fourfold increase in quarterly earnings. The financial company posted earnings that were 19 cents a share more than expected.

CVS beat Wall Street estimates by 2 cents per share in its latest earnings statement, reporting a 17 percent rise in profit. The pharmacy chain's shares fell 56 cents, to $41.21.

Insurer Cigna fell $1.98, to $60.60, despite beating expectations by an impressive 50 cents per share. The company swung to a profit from a year-ago loss and boosted its earnings outlook.

Clothiers Polo Ralph Lauren and Tommy Hilfiger both managed to surpass expectations, with Polo Ralph Lauren doubling its profit on the strength of its women's line, and Hilfiger posting a less-than-expected loss because of slumping wholesale revenue. Polo Ralph Lauren rose $1.44, to $34.56, while Hilfiger gained 49 cents, to $13.78.

Other Indicators

* The New York Stock Exchange composite index fell 17.65, to 6385.06; the American Stock Exchange index fell 13.36, to 1237.69; and the Russell 2000 index of smaller-company stocks fell 0.96, to 542.67.

* Declining issues narrowly outnumbered advancing ones on the NYSE, where trading volume rose to 1.36 billion shares, from 1.34 billion on Tuesday. On the Nasdaq Stock Market, decliners outnumbered advancers by 5 to 4 and volume totaled 1.65 billion, up from 1.48 billion.

* The price of the Treasury's 10-year note rose 31 cents per $1,000 invested, and its yield fell to 4.42 percent, from 4.43 percent on Tuesday.

* The dollar rose against the Japanese yen and the euro. In late New York trading, a dollar bought 111.13 yen, up from 110.56 late Tuesday, and a euro bought $1.2041, down from $1.2054.

* Light, sweet crude oil for September delivery settled at $42.83, down $1.32, on the New York Mercantile Exchange.

* Gold for current delivery fell to $392.20 a troy ounce, from $394.00 on Tuesday, on the New York Mercantile Exchange's Commodity Exchange.