The construction of a new symmetric code for use in all-optical code-division multiple-access (CDMA) local-area networks (LANs) is described. The new code, which is derived from prime-sequence code allows to design fully programmable all-optical encoder and decoder suitable for low-loss, high-capacity, optical CDMA LANs. It is also shown that the number of codewords of the new code is larger than that of the original prime-sequence code and the 2n prime-sequence code of the same length. Therefore, optical CDMA LANs using the new code can have a larger number of potential subscribers. The cross-correlation characteristic of the new code is also investigated and the BER performance of the code is evaluated. It is shown that the performance of the new code is better than that of the prime-sequence code of the same length.