NEW YORK, JULY 13 -- The stock market posted a small loss in a drifting session today, faced with some profit-taking after last week's rise to record highs.

Computer stocks bucked the overall downtrend, aided by positive views of International Business Machines's impending second-quarter earnings report.

The Dow Jones average of 30 industrials slipped 3.02 to 2452.97.

Volume on the New York Stock Exchange came to 152.46 million shares, against 172.13 million in the previous session.

Analysts said some traders were taking a cautious approach as they awaited the appearance of Rear Adm. John Poindexter at congressional hearings into the Iran-Contra affair.

Beyond that, they said, many market participants were concerned that stock prices might be due for a pullback after their rally in late May and June.

The frequent complaint about that advance has been its narrow concentration in the big-name blue chips, while many smaller "secondary" stocks have lagged behind.

A good part of the market's recent gains has been attributed to expectations of strong second-quarter earnings reports from companies in many industries. Brokers say it could be a problem for the market if those hopes aren't fulfilled.

Nevertheless, enthusiasm for computer stocks ran high as NCR Corp. posted improved profits for the second quarter and anticipation increased of a better-than-expected showing from IBM as well.

IBM shares climbed 2 7/8 to 169 7/8, trading at new highs. NCR, which posted quarterly earnings of $1.05 a share compared to 80 cents in the comparable period last year, gained 1 3/4 to 75 1/8.

Apple Computer, which also chalked up higher quarterly earnings, rose 2 1/2 to 40 1/2 in the over-the-counter market.

Elsewhere in the group, Digital Equipment rose 4 1/8 to 163 5/8; Unisys 2 1/8 to 126 7/8; Honeywell 2 3/8 to 82 1/2, and Prime Computer 1 to 27.

Energy stocks, by contrast, ran into selling after posting strong gains of late on rising oil prices.

Amoco dropped 1 3/4 to 86 7/8; Exxon 3/8 to 93 3/4; Atlantic Richfield 1 1/4 to 95 3/8; Mobil 5/8 to 51, and Occidental Petroleum 3/4 to 37 3/4.

Phillips-Van Heusen rose 1/4 to 25 1/8 in active trading on top of a 5 1/8-point jump Friday, when the company received a $22-a-share takeover proposal from Rosewood Financial Inc.

Analysts said traders quickly came to the conclusion that Phillips-Van Heusen might attract a higher bid.

CBS Inc. gained 2 to 181 1/2. The company agreed to sell its magazines division to a group made up of senior executives of the division.

Declining issues outnumbered advances by about 5 to 4 in the overall tally on the NYSE. The exchange's composite index of all its listed common stocks lost 0.39 to 173.18.

Nationwide turnover in NYSE-listed issues, including trades in those stocks on regional exchanges and in the over-the-counter market, totaled 174.77 million shares.

Standard & Poor's index of 400 industrials fell 0.52 to 359.30, and S&P's 500-stock composite index was down 0.77 at 307.63.