Data-rate flexible optical code-division multiple access (OCDMA) system with 511-chip superstructured fiber Bragg grating encoder/decoders is investigated from 622 Mb/s to 0 Gb/s. A compound data-rate OCDMA system is experimentally demonstrated for the future multiple service provisioning on demand. A new optical thresholder based on cascaded second harmonic generation and difference in frequency generation in periodically poled lithium niobate waveguide is introduced and successfully applied in the system.