The Dow moved into positive territory for the year for the first time since early January on Friday, lifted by defensive sectors like pharmaceuticals while a disappointing outlook from National Semiconductor weighed on technology stocks.

The healthcare sector rose as investors rotated money into defensive plays, which pushed the S&P 500 to a seven-month high. The AMEX Pharmaceutical index <.DRG> gained 1.2 percent.

Defensive plays are stocks of companies that tend to weather a recession better than others because their products -- such as food or toothpaste or drugs -- are things that people buy, even if they cut spending, in leaner times.

Procter & Gamble Co
rose 1 percent to $52.55.

But technology shares weighed on the Nasdaq after chipmaker National Semiconductor Corp posted quarterly results and gave an outlook that topped Wall Street's estimates, but the guidance fell short in comparison to an outlook earlier this week from fellow chipmaker Texas Instruments .

National Semi's shares slumped 6.1 percent to $13.59 while the PHLX semiconductor index <.SOXX>, slid 1.8 percent.

The S&P has risen 39.8 percent since hitting a 12-year closing low on March 9, leading some analysts to believe a pullback is in the offing.

Everybody is waiting for a correction and certainly when that correction comes, those sectors that will do well are your more defensive sectors, said Tim Ghriskey, chief investment officer of Solaris Asset Management in Bedford Hills, New York.

The Dow Jones industrial average <.DJI> gained 28.34 points, or 0.32 percent, to 8,799.26. The Standard & Poor's 500 Index <.SPX> gained 1.32 points, or 0.14 percent, to 946.21. The Nasdaq Composite Index <.IXIC> dropped 3.57 points, or 0.19 percent, to 1,858.80.

For the week, the Dow gained 0.4 percent, the S&P 500 added 0.7 percent and the Nasdaq rose 0.5 percent.

For the year, the blue-chip Dow average is up 0.26 percent.

Other defensives such as utilities also rose, with FirstEnergy Corp rising 3.6 percent to $40.48. The S&P Utilities index <.GSPU> advanced 1.4 percent.

Among the tech bellwethers, iPod and iPhone maker Apple Inc shed 2.1 percent to $136.97 and BlackBerry maker Research in Motion fell 2.8 percent to $83.02. They were the top two drags on the Nasdaq.

The Reuters/University of Michigan Surveys of Consumers showed consumers' mood in June stood at its highest in nine months, but worries about inflation and labor market uncertainty persisted.

Shortly before midday, the New York Stock Exchange was hit by a technical glitch that temporarily halted trading in about 240 stocks, including blue-chips General Electric , Exxon Mobil and Bank of America . Server connectivity was restored around 12:10 p.m.

Trading volume was low on the New York Stock Exchange, with only about 857 million shares changing hands, sharply below last year's estimated daily average of 1.49 billion, while on Nasdaq, about 2.05 billion shares traded, below last year's daily average of 2.28 billion.

Declining stocks outnumbered advancing ones on the NYSE by 1,623 to 1,369 while on the Nasdaq, decliners beat advancers by 1,442 to 1,236.

(Editing by Jan Paschal)