Hi ,
Thanks for sharing your concerns.
The boy is suffering from
constipation which is quite common at this age.
For immediate relief you can use glycerine suppository or
enema for evacuation of hard stools.
This should be followed by stool softeners for several weeks.
The blood beside the back passage is due to "anal fissure", a tiny bit of tear in the inner lining of anus caused by hard poo.
This anal tear is painful & generally takes 4-6 weeks to heal and till that healing takes place ask your doctor to prescribe stool softeners .
Local application of cream is also helpful in relieving pain.
Also review his diet with the doctor & consider increasing water intake.
Hope you find the information useful.
Wishing him a good health.