Hello, my name is***** and I have over 20 years of experience as a veterinarian. I am sorry to hear that your fellow isn't feeling himself today, and is vomiting foam.
Vomiting foam simply is a mix of air and stomach/esophageal mucous made when he retches, it is not indicative of any disease process but tells us he is quite nauseous.
I understand that he hasn't passed a stool. How long has it been since he passed stool? Were they normal stools?
Dogs that are vomiting and not eating won't have ingesta to make stools, so it's possible that is the trouble.
But dogs that are constipated (straining to pass very hard stools that are very large or small rock-like stools) can have back pressure on the gastrointestinal tract and that can lead to vomiting.
In your fellow's case it will be important to note the kind of stools he was having before this started, and whether he stopped passing stools and then started vomiting foam, or started vomiting and then stopped passing stools.
Is he running a fever (rectal temperature greater then 103F)?
Does he have a tense, painful abdomen with gentle pressure on his belly with your hands?
Vomiting and nausea can be due to stress, a change in diet, parasites, a viral or bacterial infection, eating something he should not (like a piece of a toy or something he found outdoors), inflammatory bowel disease or even a food allergy. But it can also be related to metabolic organ disease (such kidney or liver disease) due to organ wastes irritating the gut, pancreatitis, or an obstruction in the gastrointestinal tract.
To try and settle his stomach today you can give either:
1) Pepcid-ac (famotidine) at a dose of one 10mg tablet per 20 to 40 pounds of body weight every 12 hours.
2) Prilosec (omeprazole) at a dose of one half of a 20mg tablet per 20 to 40 pounds of body weight every 24 hours.
These will reduce stomach acid and should help if this is related to simple nausea and gastrointestinal irritation.
I would wait to feed him any food until tomorrow morning. This should help stop gut spasms and restore normal gut motility.
Starting in an hour or so small amounts of water or clear broths like low salt chicken broth offered frequently are fine as he needs fluids. You can give him pedialyte to replace electrolytes too, though most dogs don't like the taste.
After his food fast offer him a bland diet mix of 1/3 boiled, white skinless chicken, or boiled, very lean ground meat, all fats and juices drained off the meat, mixed with 2/3 boiled, plain white rice. Feed several small meals a day.
Once he feels better (no retching for 48 hours) start mixing in his regular dog food very slowly, less bland more regular with each day. It should take a week or so to convert him back.
If your fellow is continuing to vomit, runs a fever or has a tense painful abdomen and is feeling poorly though it would be best that he see a veterinarian now as anything you give him orally will just come back up worsening his dehydration.
Best of luck with your pup, please let me know if you have any further questions.