Hi and welcome to Just Answer.
Diarrhea can be caused by numerous things in dogs. In your case, because your dog is painful during defecation and because he is an intact male I would suggest that the most likely cause is prostate disease.
r there treatments available for this?
Older, intact males often have inflammation, infection or even cancer that can affect the prostate making it difficult and very painful to defecate. Diarrhea is often associated with this. I would definitely recommend an exam by your vet including a rectal exam. From there your vet may recommend x-rays or ultrasound, biopsy, culture etc. to clarify the diagnosis.
we're taking him to his normal vet this afternoon...thank you for ur help!
If your vet feels that it is just inflamed or infected then routine antibiotic treatment and/or anti-inflammatory treatment frequently improves the condition. Neutering will also help dramatically and generally keeps the condition from returning.