Hi. It does sound as if your companion is in pain. I know it's hard, but please help end his suffering. Thoughts are with you.
Tony
Yes, you need to put your dog out of it's misery as it is suffering. So sorry.
"..old and hes dying.."? Then it sounds to me like he needs to be taken to your vet and humanely put to sleep. His whining certainly is to tell you he is suffering, and to let it go on is cruelty.