The paper considers the design of two families of binary block codes developed for controlling large numbers of errors which may occur in LSI, optical disks and other devices. The semidistance codes are capable of assuring a required signal-to-noise ratio in information retrieval; the "t-symmetric error correcting/all unidirectional error detecting" (t-SyEC/AUED) codes are capable of correcting t or fewer symmetric errors and also detecting any number of unidirectional errors caused by the asymmetric nature of transmission or storage media. The paper establishes an equivalence between these families of codes, and proposes improved methods for constructing, for any values of t, a class of nonsystematic constant weight codes as well as a class of systematic codes. The constructed codes of both classes are shown to be optimal when t is 0, and of "asymptotically optimal order" in general cases. The number of redundant bits of the obtained nonsystematic code is of the order of (t + 1/2) . log2 k bits, where k is the amount of information encoded. The obtained systematic codes have redundancy of the order of (t + 1) . log2 k bits.