Mountain View-based Veritas Software Corp. said it signed a definitive agreement to buy OpenVision Technologies Inc. for about $400 million in stock. The merger would join two makers of software used to help corporate users organize and retrieve computer files and to keep data from becoming lost or corrupted. Veritas said it will offer 7.5 million shares of its stock to acquire OpenVision. Based on its closing share price of $56.125 on Nasdaq, the merger would be valued at $420 million. OpenVision shareholders will receive about 0.35 Veritas share for every OpenVision share they own, the companies said. Veritas had $25.3 million in revenue in the first nine months of 1996. Pleasanton-based OpenVision had $25.6 million in revenue in the same period. Mark Leslie, chief executive and president of Veritas, would retain those titles as head of the new company.