* Morgan Stanley rises as profit beats expectations
* CSX forecast miss drags rail stocks lower
* Vertex at record high on cystic fibrosis treatment data
* Dow up 0.22 pct, S&P 500 up 0.50 pct, Nasdaq up 0.65 pct (Updates to early afternoon)
By Rodrigo Campos and Kimberly Chin
NEW YORK, July 19 (Reuters) - The Nasdaq Composite and the S&P 500 hit record highs on Wednesday, powered by technology stocks and a more than 20 percent jump in Vertex Pharmaceuticals, while gains on the Dow were capped by a sharp drop in IBM shares.
Vertex jumped as much as 26.4 percent to an all-time high of $167 a day after it reported positive results for its cystic fibrosis treatment. The stock last traded up 21.6 percent at $160.67, and was the biggest boost on the S&P and the Nasdaq.
IBM was a drag on the Dow industrials after its quarterly revenue came in below expectations and the stock fell 4.4 percent to $147.16, having hit a 13-month low of $146.71.
However, the S&P 500 tech sector is on track to break a record closing high set in March 2000. It has been the best performing sector this year in terms of percentage gains.
The Dow Jones Industrial Average rose 48.14 points, or 0.22 percent, to 21,622.87, the S&P 500 gained 12.34 points, or 0.50 percent, to 2,472.95 and the Nasdaq Composite added 41.18 points, or 0.65 percent, to 6,385.48.
Analysts estimate an 8.7 percent rise in second-quarter earnings and a 4.6 percent increase in revenue for the S&P 500 companies from a year earlier, according to Thomson Reuters I/B/E/S.
Morgan Stanley rose 3.5 percent to $46.72 after the Wall Street bank reported better-than-expected profit and bond trading revenue declines that were modest compared with arch-rival Goldman Sachs'. The KBW bank index fell 0.5 percent.
Bank "earnings have come out pretty well, but apparently not enough for investors to keep them running, to keep the prices up," said Giri Cherukuri, head trader at OakBrook Investments LLC, which oversees $1.3 billion in Lisle, Illinois.
"People were expecting good earnings, and people were expecting the Fed to raise rates which would be good for the stocks. A lot of the expectations were built in already. It was tough to go further."
CSX fell 5.1 percent to $51.85 after the railroad operator's forecast missed expectations, and it dragged stocks of its peers lower. Union Pacific fell 1.4 percent, while Kansas City Southern dropped 0.8 percent.
The transport sector was also hit by declines in airlines as United Continental Holdings fell 6.1 percent to $74.09, a day after it forecast "disappointing" passenger unit revenue for the third quarter.
Advancing issues outnumbered declining ones on the NYSE by a 2.93-to-1 ratio; on Nasdaq, a 2-to-1 ratio favored advancers.
Reporting by Rodrigo Campos and Kimberly Chin; Editing by Nick Zieminski