I agree, it looks bad. Cast iron replacement is not for the novice. It is connected with molten lead poured into the joint which is packed with oakum. Of course it can be replace with PVC, but that is also not something to be taken lightly...pun intend...cast iron is extremely heavy and requires special tools to cut apart. I would strong suggest you call a plumber to examine your entire drain system and see how much needs to be replaced. It may not be the entire system gone bad.