its either constipation or intestinal worms, the problem is they can both present the same symptoms. If the fish is eating try feeding it some cooked de-shelled peas, this will clear the constipation - do not feed him any thing else for a couple of days. I know its hard but try to see if he does pass faeces when he does if he does not start swimming normally a course of an antibacterial treatment maybe in order.
If you do see him pass faeces check it is not white and stringy, also check when he/she is still or resting if there are any red threads hanging from its anus, these would be camalanus worms.