Production and decay of charmed mesons at the Z resonance