Study of charm production in Z decays