Natures Miracle, works like a charm, I haven't met a pet stain yet that it wont get the odor out of, you can pick that up at just about any store with a pet section now adays!
Your first step should be to bring him into the vet.
How long has this been going on for, how often does it occur, where does it happen, and have you noticed anything else different about your cat. These are just a few questions you should ask yourself, because the doctor will also want to know.
One thing that I don't think was mentioned, make sure the litter box is LARGE, some cats hate and wont use a litter box that is too small.