IF the flange is just rusted and corroded that is normal for an old cast iron flange and is really not a problem. Just chip the worst of the rust off the mating surface with a stiff putty knife or 5 way painters tool then brush it up as clean as you can with a wire brush. Cast iron is normally sort of pitted looking but the wax ring will compensate for that.
Quite often we find old cast iron flanges that have a portion of the screw slot broken off. Rather than replace the flange you can install a repair flange which fits directly under the lip of the old flange and it bolted in place.
If you elect to remove the cast iron flange you can replace it with PVC. There are numerous methods of attaching the new PVC to the old cast iron.
1. You can cut the cast iron with a "cast iron Snap cutter" to get a smooth end, then attach the new PVC to the old cast iron with a PVC x CI (CI= cast iron) rubber Fernco coupling.
NOTE: You can usually rent a cast iron snap cutter from a local tool rental company for about $15 to $20 for a day. Cutting the cast iron with a snap cutter will take about 5 minutes and will make a perfect cut. It can be done with a sawzall but usually will take about 45 minutes to an hour and will use 5 or 6 blades which cost $4 each, so in the end renting the snap cutter will prove the most economical solution.
Cast iron pipe is super strong but a very brittle metal. You can easily break out a section of cast iron with two 2LB hanmmers.
CAUTION: before cutting or breaking out a section of cast iron, espeically when working on vertical stacks, make sure the pipe above the point of the cut is well supported by hangers or blocking and bracing. When in doubt take the time to install additional strap hangers to support the upper section. Failure to do this can and often will result in the piping above the point of cut falling down, which may cause serious property damage and/or personal injury.
Hold one hammer tight against the pipe wall on one side and rap the pipe on the opposite side with the second hammer. The cast iron will shatter. Once you have it shattered out you can continue breaking it out until you get to a hub on the downstream end of the section your are removing. Once you have the cast iron broken out, drill three or four holes close together in the lead to get a starting point, then insert a pry tool into the holes and pry the old lead out, then clean the oakum out (Oakum looks like frayed hemp rope).
Fernco makes a rubber donut gasket that can be used to seal the new PVC into the cast iron hub or you can insert the PVC into the hub, pack the hub half full of Oakum and top it off with plumbers epoxy.
