Consider the headaches that faced William E. Douglas when he took the job as the nation's chief cash manager four years ago.

The government was handling a staggering $2 trillion every year, moving it through the untrained hands of hundreds of middle-level bureaucrats in scores of agencies. The old computer network, which was state-of-the-art in the 1950s, had become hopelessly outdated.

The government was paying many of its bills too late -- and many more too early. Grant and contract money was being disbursed haphazardly, usually in lump sums. And it often took weeks, even months, to track down complaints of lost Social Security or payroll checks.

Enter Douglas, a 20-year veteran of the Internal Revenue Service, with a soft Carolina drawl and a Wall Street view of sound money management that matches his conservative blue pin-striped suits.

As commissioner of the Treasury Department's new Financial Management Service (FMS), Douglas has presided over the most sweeping reform of federal cash management since Treasury Secretary William Windom established the first Treasury General Accounts in banks around the country in 1890.

Now Douglas has another distinction rare these days in government: he heads one of the few agencies anywhere that can claim to be making money. "Right now," he said confidently, "our savings for this year, through our various cash management initiatives, will probably be about five times our annual budget," which is $240 million.

"We are making a profit -- a very substantial one -- and saving the taxpayers a lot of money," he said.

Explaining the rapid pace of the reforms, Douglas said, "It certainly seems to be faster than evolution. I'm not sure it's revolution . . . . There is much more emphasis today than there has been previously on cash management."

That new emphasis has taken many forms. In 1984, the Grace Commission, the presidentially appointed cost-cutting panel, cited cash management as an area ripe for savings. The Reagan administration launched its "Reform 88" program, aiming to put 350 cash management changes in place by 1988. To underscore the new concern, the Treasury's old Bureau of Government Financial Operations was renamed the Financial Management System.

Besides spearheading the new cash management campaign, the FMS makes most of the government's payments, both through checks and electronically. It manages revenue collections with the aid of about 14,000 banks nationwide, and it prepares periodic reports on the government's financial transactions.

At the hub of it all is Douglas, the government's version of the corporate cash manager, constantly vigilant for the best investments while trying to squeeze every last bit of interest out of the government's massive cash accounts. Like the old stagecoach cowboys who guarded the bank deposit bags, Douglas rides shotgun over a cash flow of more than $7 billion each day, juggling collections and payments against the federal government's daily borrowing needs.

Yet, managing that cash flow like a business is a task fraught with obstacles that make Douglas somewhat envious of his corporate counterparts. Not the least of those obstacles is the absence, in government, of the business world's "profit mentality."

"In some ways, it may be easier to manage in the private sector because of that cliche about 'the bottom line,' " Douglas said. "You can see your successes. That bottom line is not as obvious in the government."

Another problem is that cash-flow responsibilities are widely dispersed throughout the bureaucracy, and decisions frequently rest not with expert cash managers but with program managers who may not even realize that their decisions affect cash management.

Take, as an example, the case of the departmental program manager who must arrange payment of a $1.5 million, two-year grant.

That money can be disbursed in many ways -- all at once, monthly, twice a year. The decision could determine whether the government or the grant recipient gets the benefit of hundreds of thousands of dollars in interest, and also could affect federal borrowing needs at a time of a $200 billion budget deficit.

"One way is to give them the lump sum at one time," Douglas said. "That's poor cash management . . . . Putting that money out there on precisely the day it is needed, now that's good cash management. That's a cash management decision because it saves the government money."

He added, "You can see how important it is to have the program manager sensitive to that cash management position." Over the long run, the cash management program -- and specifically the "Reform 88" proposals -- depends on that kind of sensitivity.

"If we're going to be successful, our fate is in the hands of the people out in the agencies," Douglas said.

Most program managers are not trained in the often-Byzantine ways of cash management, but Douglas said that could be changing.

If so, it could provide the underpinning for systematic reforms that Douglas hopes will turn federal cash management from a kind of hit-and-miss poker game into something roughly akin, if not identical, to the corporate world.

One such change has been in the "timely" payment of bills. Congress, reacting to complaints by small businesses that the government never paid up on time, passed the "prompt payment act" in 1982, forcing federal agencies to pay their bills on time or be hit with costly interest penalties.

But the General Accounting Office later found that the bill-paying problem was not merely a matter of paying too late. The government was paying so many bills early that it was losing as much as $250 million in interest each year. "We don't want to make payments one day late," Douglas said, "but we also don't want bills paid one day early."

Now the government is making increasing use of electronic bill payment, which gives it the benefit of the "float" on its cash until the exact time that bills are due. About 85 percent of nonmilitary federal dollars are now paid out electronically, and the FMS is working with the Defense Logistics Agency to automate the Pentagon's bill-paying system.

Douglas' office also has drafted legislation, now awaiting approval from the Office of Management and Budget, that would allow most federal employes to be paid through the use of electronic funds transfer, known in the official jargon as EFT.

Savings from EFT come because it takes less time than processing paper checks and fewer payments are lost. CAPTION: Picture, Financial Management Service chief William E. Douglas rides shotgun over cash flow of more than $7 billion a day. BY DOUGLAS CHEVALIER -- The Washington Post