Whenever a defendant has been held to answer at a preliminary examination to await the action of the grand jury or has been held for the circuit court, the prosecuting attorney may proceed to file information in the circuit court and to trial of the case, provided the prosecuting attorney, with the consent of the circuit court, may nolle prosequi any indictment or information pending in the court.