The Tokyo Stock Exchange suffered its worst-ever technical failure when a programming bug in the computerized trading system shut down the entire system throughout early August 1.

The crash set off a flurry of sales that sent the Nikkei average plunging to 19804.38, down 527.05 from July 31. It marked the first closure below 20,000 since July 11. Exchange officials initially could not identify the cause, But by late afternoon, the breakdown was traced to a bug in the software that handles trading for foreign section issues.

The system started to malfunction at around 8:20 a.m., after it started taking orders from brokerages. The backup system, which runs on the same computer program, also broke down. Both of them were developed by Hitachi Ltd. and were installed by the exchange in August 1989.

Computer-based trading of 1,702 stocks on the first, second and foreign sections, as well as that of 724 convertible bonds, resumed at 12:30 p.m. Transactions of the leading 150 issues and of government bonds were conducted without interruption since they are traded manually on the floor.

It was the second computer malfunction to halt trading but the first major suspension since the TSE introduced computer-based trading in 1982. On Oct. 3, 1990, the exchange experienced a 45-minute computer breakdown. As a result of the computer crash, the morning's trading volume was half that of an average session.

TSE President Mitsuhide Yamaguchi offered his apology for the suspension. Yamaguchi said in a statement that he offers his "heart-felt apology for the partial trading halt which led to inconvenience for investors, member brokerages and other parties."

Hitoshi Shimakura, managing director of the TSE, said in a news conference that the trouble occurred when the computer tried to take orders for stocks of a certain foreign issue, which he did not identify. Ordinarily for foreign stocks, the system matches sell and buy orders, and sets acceptable price ranges for transactions based on the previous day's closing prices of stocks at the markets where foreign firms are based. Orders that do not fall within the price fluctuation ranges will be automatically erased by the system. However, the program failed to erase those orders, creating a system conflict early August 1. Shimakura said.