Rep. Barney Frank (D-Mass.) called it the Rasputin of the 98th Congress: clubbed, shot and poisoned, the immigration bill refused to die.

In the end, after filibuster threats, rules wrangling and ceaseless attacks, the legislative clock ran out on the landmark measure and its exhausted supporters had no time left to compromise.

The shelving of the immigration bill was significant on several counts.

It was the major punctuation point in a nearly 15-year effort to stop the flow of illegal aliens into this country, especially across its southern border.

On a different level, the bill's demise also shows how difficult it is for Congress to wade into complex areas, particularly in an election year. Bills on civil rights, school prayer and hazardous waste all went down this year. But immigration in some ways was the toughest, with its dual strains of openhanded generosity to outsiders and deep-seated fears about them.

The legislation would have given amnesty to millions of illegal immigrants, while imposing new fines on employers who continued to hire so-called undocumented workers.

It was a carefully crafted compromise designed to balance the needs of different, often diametrically opposed groups. As a result, a provision designed to bring one group on board often drove another toward resistance.

Hispanics, for instance, wanted the amnesty provision, but could not accept the employer sanctions, which they said would increase job discrimination. Conservatives supported the sanctions, but could not abide the amnesty.

Supporters of the bill say an election-minded Congress failed to rise to a pressing national problem to avoid getting caught in the cross fire among a half-dozen powerful interests.

"It was sort of a paragon of whether general interest can prevail over personal interests," said Rep. Charles E. Schumer (D-N.Y.). It was a "classic" test, he said, that the 98th Congress failed.

"No one was out there lobbying for the bill . . . except good sense," said Rep. Leon E. Panetta (D-Calif.).

Legislation to deal with illegal immigration has been around Congress since the early 1970s, when the problem first got publicity.

Reports at that time put the number of undocumented workers at around a million, most of them coming across the sparsely patrolled, nearly 2,000-mile-long border with Mexico.

Concerns were raised not only about the exploitation these people faced, but also about their effect on the job market. They were spreading across the country and taking jobs from American workers.

In 1972 and 1973, Rep. Peter W. Rodino Jr. (D-N.J.), whose father was born in Italy, introduced legislation that attempted to stop the flow of illegal aliens by imposing sanctions on their employers.

Rodino got his legislation through the House but in both years it got stuck in the Senate. In 1975 he introduced another bill, and that one never made it through the House Rules Committee. After that, he gave up.

In August 1977, President Jimmy Carter proposed some employer penalties and an amnesty program to draw illegal immigrants for the first time into the public mainstream. His proposal was viewed as too controversial. It fizzled.

But continued concerns over "losing control" of U.S. borders led Carter to set up a special commission. The commission made sweeping recommendations in 1981 that combined the Rodino and Carter approaches and also recommended increasing border patrols.

The next year the commission's recommendations were introduced by Sen. Alan K. Simpson (R-Wyo.) and Rep. Romano L. Mazzoli (D-Ky.), the chairmen of the immigration subcommittees of the Senate and House Judiciary Committees.

Simpson and Mazzoli came from areas little affected by illegal immigration. But both saw it as a national problem. Simpson had been on Carter's special commission.

When the original Simpson-Mazzoli bill, approved by the Senate, died in the House in 1982, under assault by Hispanic lawmakers, they were determined to try again.

It was clear from the beginning of the 98th Congress that Simpson and Mazzoli had much to overcome. They introduced the bill early in the session.

The Republican-controlled Senate, with no Hispanic members, quickly passed the bill.

But the Hispanic Caucus in the House, which opposed the bill in the 97th Congress, again went after it on the same grounds -- that employer sanctions would increase discrimination against all Hispanics because employers would be reluctant to hire anyone with a Hispanic surname or Hispanic facial features.

This time, Hispanics went through House Speaker Thomas P. (Tip) O'Neill Jr. (D-Mass.).

O'Neill, forewarned that the bill could lead to a national identity system, and concerned about offending a strong Democratic voting block, announced last October that he would not let the bill come to a vote. The Simpson-Mazzoli bill appeared dead.

Under significant pressure from supporters of the bill in his own party -- and after being pilloried for weeks by Republicans -- O'Neill changed his mind. After a last-ditch effort by Hispanics to block the bill through House rules, the measure came to a vote in June.

More than 60 amendments were offered during seven days of impassioned debate. Throughout, the corridors outside the chambers were lined with lobbyists.

Western growers, historically dependent on illegal immigrant field hands, persuaded the House to accept an amendment setting up a new temporary foreign farm-worker program. They also succeeded in deleting criminal penalties against employers of illegal aliens.

Hispanic Caucus members offered a series of amendments to kill or significantly water down the bill. The AFL-CIO and the U.S. Chamber of Commerce both lost amendments. The three groups preferred the status quo to the House product.

Conservatives failed to eliminate or water down the amnesty provision. The Reagan administration and House Republicans failed to reduce the costs of the bill. Liberals only half succeeded in gaining greater protection against potential discrimination.

But the bill, supported by countless newspaper editorial boards across the country, squeaked by, with just five votes to spare. Democrats and Republicans were equally divided.

The vote was hailed as a sign of Congress' ability to deal with tricky issues, even in a presidential election year.

The momentum seemed to favor successful completion of the measure in a House-Senate conference committee, although a conference agreement would have to face new votes in both the House and Senate, where efforts to kill the bill were again likely.

It was then that presidential politics intervened.

Hispanic groups, liking the bill's amnesty for illegal aliens but hating more its provision for employer sanctions, threatened to make the bill a litmus test for support in the November election.

When the Democratic National Convention opened in San Fransisco in July, presidential nominee Walter F. Mondale and his running mate, Rep. Geraldine A. Ferraro (D-N.Y.), came out strongly against the measure and said they would work to kill it.

The White House, which had endorsed the immigration measure with modifications, grew more tepid in its endorsements after that. President Reagan, apparently concerned about the cost of the bill, never gave it strong support.

When Congress reconvened after the Republican and Democratic conventions with just a few weeks until adjournment, the immigration conference held its first meeting. For more than a week, it flowed smoothly, despite efforts by Hispanics, unions and the U.S. Chamber of Commerce to kill the bill.

Compromises quickly were reached on the expected sticking points, amnesty and employer sanctions. The negotiators also curtailed the temporary farm worker program that western growers had persuaded the House to include in the bill. This decision persuaded the growers to join the ranks of opponents. A seemingly minor issue, an anti-discrimination provision added to the bill by Rep. Frank, brought the conference to a halt. Conservatives and the White House opposed the provision; liberals were determined to keep it.

A behind-the-scenes effort by Rep. Schumer produced a compromise on that matter last week. But a new stalemate developed on a cost-containment provision demanded by the White House.

The conference committee had voted to recommend in the report accompanying the final compromise that annual federal reimbursements to the states for the cost of legalization not exceed $1 billion. Reagan indicated that he would veto the immigration bill if the conference did not write the limitation into the immigration statute as a fixed cap.

Gov. George Deukmejian of California, a strong Reagan backer who had been quiet to this point, came out in full force against the cap. According to several lawmakers, growers, now adamantly against the bill, also used their influence.

They persuaded several Republican negotiators from California agricultural areas, who had voted to put the limitation in the conference report, to vote against putting into the law itself a cap on funds, lawmakers said.

Without the votes to approve the cap, the conference dissolved. The Simpson-Mazzoli bill was dead for the 98th Congress.

Mazzoli later said that even if the cap problem had been resolved, he was certain another issue would have arisen.

"The technique and strategy [of opponents] was to always have one last issue." he said.

Frank said that as Election Day approached and the pressure against the bill built, lawmakers regularly approached him suggesting that the bill should be killed in conference.

Mazzoli said this week that he is not sure he has the energy to again pursue the bill. He suggested that Congress may be willing to deal with the problem of illegal immigration only by beefing up border patrols.

But Rep. Robert Garcia (D-N.Y.), who stood on the House floor for seven days last June trying to kill the measure, said he expects another round. "I don't think the bill died, in the sense that it won't come back," he said. "It's just been laid to rest.