Peekawho has given you correct information as always! Thanks Peekawho!
It might be a good idea for your vet to get a culture and sensitivity of your dogs anal gland secretions, especially if clogged anal glands becomes a chronic problem.
If, after rectal exam your dog's vet did not think that the anal glands, rectum, or perianal area had any evidance of cancer (no obvious masses, pigment changes, or swelling) than it would be very difficult to impossible to find a cancerous area to biopsy. In other words, no masses, or unusual changes = a non-diagnostic biopsy. However, if there is anything unusual than it should be biopsied.
The masses on the abdomen should have FNA's (fine needle aspirates) performed, and if the results show anything unusual they should be biopsied.
At age 10 degenerative joint diesease is a strong possibility, and if your dog is not on a Glucosamine and Chondroitin Supplement, than he should be. A NSAID (non steroidal anti inflammatory) may also be necessary if your dog's liver function is normal.
I suggest you do have bloodwork performed: Complete blood work, Heartworm, Lyme, Ehrlichia, and Anaplasmosis, Rocky Mountain Spotted Fever, urinalysis, culture and sensitivity or anal gland secretion, X-Rays of joints, especially hips and knees, and anything else your vet deems necessary.
Lastly, food allergies can cause anal gland problems, along with other problems, which can be very vague, and food allergies can develop at any time in a dog's life.
It sounds like a good check up is in order asap, if you haven't had one for him recently. He's getting up there in years, and may need a senior dog workup done (bloodwork checking for different disorders) if one hasn't been done already.
The lumps on his stomach also need to be evaluated, I would think, unless your vet has already done so.
Hopefully, Dr. Cheng will have some good suggestions for you.