Use a pipe wrench to loosen the cap on your main line drain pipe before you open it entirely.
Drain clean out cap stuck.
Heat the cleanout plug and fitting clean away any.
Https amzn to 3lszden make your own sewer.
Https amzn to 354hhrh plumber s pipe wrench.
Once it s safely removed use the old fitting as a guide to cut a replacement section of pipe and clue up a new.
Slide both couplers onto the old pipe then slide the vertical.
I let the water drain out then i cut out the nut using a metal cut off wheel rotozip.
If all your efforts fail you may have to cut out the fitting and install a new one.
After this i used the cut off wheel to slice away portions of the cap until i could get near the inner.
Dousing the plug several times with penetrating catalyst lubricant often also called a rust breaker is another way to.