I’m an experienced cat owner (some call me a “cat lady”). As others have said, you need to first take him to a vet for an evaluation. Typically, when they start doing this at his age there is a pathological reason. If they give him a clean bill of health, they still might be able to help. I currently have a cat who takes an antidepressant for this very problem, for instance. It is, unfortunately, true that once he has urinated in a spot he is likely to continue even if the underlying problem has been successfully treated. You might have replace the carpet.
Before going to the expense of trashing the carpet you could try a product by Biokleen called BAC-OUT. You can find it at Whole Foods, Fred Meyer and other stores as well. It’s a stain and odor eliminator that is natural, non-toxic and biodegradable. It contains live enzyme cultures which basically “eat” the bacteria that are creating the odor. It also has lime peel extract for cleaning power. I’ve used it when my dog has had an accident when she was sick and I think it works well. No stains, no odor after I’ve used it.