Been there. Get the rail from Rudy as stated. Not cheap but duplicates original. As is pretty obvious, the tricky part is bending the corners. I built wooden duplicates of the hull corners and bow to use as templates. Notched and then heated the PVC base, bent it around the wooden pieces and screwed it to the wood until it cooled. Otherwise you will need the hands of several friends to hold everything in place until it cools. You will get 3 sections, 25' each, of PVC base to do a OD34. You should have enough to be able to practice notching and bending a corner - this is the toughest part to get a smooth bend without "wrinkles" in the PVC, no gaps between the PVC and hull and yet not so tight that the insert doesn't stay in its slot. I pre-bent the stern corners and bow, one bend per 25' piece, and then installed the sections on the boat. Install each piece by installing the pre-bent corner first so you can get the corner to fit tight. Then work away from the corner in each direction. Let the ends overlap and then trim the ends to fit. The black insert is one piece.When installing the insert you may have to heat it to fit the corners smoothly. Do NOT stretch it. If anything, try to push it back the opposite of stretching. It will shrink over time and the joint will pull apart. Put the insert joint in the center of the transom. Be sure to offset the PVC base joint so the base joint is not in the center of the transom. I did this project several years ago and it came out better than original.
Another caution when buying the rub rail. Rudy stores the base laid out straight but the base will be shipped coiled. Straighten it out as soon as you get it so it doesn't hold the coiled shape. I made the mistake and left it coiled. To straighten it I had to lay it out and screw it flat to an unused dock where it would be in the sun. It took a few weeks of warm weather until it stayed flattened.
I picked up a 25 foot section from Rudy several years ago and use it to splice in pieces if they get damaged. No need to replace the entire thing if only a small section is fractured. Just cut out the bad section use the old one to transfer the screw hole locations to the new piece and cut the ends at a 30 degree angle or so so the seam blends in. A little 3m 4000 to fill any seam gaps and you're good to go.