It took three seconds for the video terminal to flash the answers: The number of workers at the Forest Haven institution for the retarded is 777, and together they earn $14,212,090 a year.

Another three seconds and the computer spit out more specific informational bits: the names and job descriptions of the 20 doctors and administrators at Forest Haven who earn more than $40,000 a year, and the names of the two maintenance men who make less than $8,000.

What seems like a typical performance in an age of high technology actually represents a minor revolution at the D.C. Department of Human Services, the city's largest agency, where past confusion and mismanagement have been legendary and where seemingly simple questions, such as the number of persons on a payroll, were difficult to answer.

DHS is entering its new world of computerized "management information systems" in a $1 million effort to bring order to its $550 million budget and its payroll of 6,149 persons who run more than 100 programs, including Medicaid, welfare, food stamps, health, mental illness and retardation and drug and alcohol abuse.

"We're the size of the Fortune 500s. . . . We're bigger than almost any company in town. As a result, we have big management problems," said DHS controller James R. Boyle, the plain-talking former D.C. school system controller who said he was dispatched two years ago to DHS "to clean up the goddamn mess" in its finances.

In past years, DHS management horror stories were routine. In 1980, the department had a $33 million deficit, and its budget and personnel system were in such disarray that DHS couldn't tell how many persons worked in each division, city officials said.

Shortly after he took over as DHS director in April 1980, James A. Buford concluded in a report to Mayor Marion Barry: "The department's financial functions are not badly managed--they are unmanaged."

Just last year, when DHS was asked by U.S. District Court to specify the number of jobs vacant at Forest Haven as part of a lawsuit over substandard conditions, the department couldn't answer, Boyle said. He described that frustration as the "inciting incident" in creating the new management system.

The city awarded the job to American Management Systems of Arlington, which also designed the District government's primary accounting system.

DHS, like other agencies, has been computerizing many of its operations for years, but not always with optimum results. When the city's 27,000-case welfare rolls were fed onto computer tapes in December 1981, for instance, several thousand families were wrongly cut from the rolls because of foul-ups with new, complicated computerized forms.

The new personnel budgeting and control system gives the DHS central office an up-to-the-minute glimpse of each division's personnel budgets and projected spending, Boyle said. He said this is a dramatic advantage over the old system, in which he said financial data was sometimes kept on three-by-five cards, with some divisions spending seemingly without limits and huge deficits resulting.

Only four weeks into the fiscal year, DHS already has used the new system to pinpoint a potential $9 million deficit in its personnel budget, Boyle said, and will have an early start on attacking it. "We know the problem today, in October instead of June," he said.

A key to the new system is it gives DHS managers the capability to get answers to specific questions, or in computer parlance, "the ability to query the data base," Boyle said. DHS officials said the system is the most advanced of its kind in city government.

If DHS needed to find a new provider for day care, for instance, it immediately could get a listing of the money remaining in the day-care budget, the names of day-care providers under contract with DHS, their unit costs and other necessary data, said Randy Roth, project manager for the AMS consulting firm.

"If you asked that question at DHS six months ago, it could take three people a month, and right now, if you had the terminal on your desk, you could answer those questions in less than a minute," Roth said.

DHS also will be able to get weekly health clinic reports pinpointing the number of patients using each facility and each medical specialty, Boyle said, allowing the department to quickly transfer personnel to cope with heavy patient loads.

"In the past, DHS executives used to spend all their time figuring out what the facts were, and when they finally were confident of facts, they were too exhausted to make decisions, or it was too late," Roth said.

The system, which started in July but is being expanded, will include DHS's personnel budget, inventory of contracts worth more than $60 million and "foster-care tracking system," designed to keep data on the city's 2,200 foster children. The system operates on 40 terminals in DHS offices, with telephones linking it to the data bank in the basement of AMS's Arlington headquarters.

With all its sophistication, will the new system work?

"Nobody really knows for sure," Roth said, smiling.