We demonstrate optical code-division multiplexing (OCDM) systems using a new optical orthogonal code (OOC) to support multirate and variable-rate data communications. An important characteristic of the proposed codes is that their autocorrelation and cross-correlation operations are dependent only on each individual code word rather than a periodic pulse sequence at the input of OCDM receivers. Consequently, multirate and variable-rate data communications are offered without violating cross-correlation and autocorrelation constraints of 1. This is achieved without increasing any system complexity. Compared with conventional OOCs, our proposed codes not only can have shorter code-word lengths for multirate and variable-rate data communications, but also have high flexibility and performance. Experimental OCDM systems using the proposed code are also carried out.