Ulcers are now known to be caused by h-pylori bacterium. 99% people who have ulcers have bacterial infection in the stomach.
As I mentioned to the poster above, you are replacing food for some other emotional issues. You are the only one who can figure that out. When you think of eating, stop and say am I really hungry? how am I feeling right now? am I sad, angry, hurt etc? If you can settle and say that I am going to be calm about anything that is on your mind, focus on happy thought and then eat. Take food on a plate as you would normally and then take out 50% of it. Once you finish eating do not think of eating anything else. Sugary foods actually make you eat more. Use Stevia if you like sweet stuff. Also do not eat white flour and other junk foods.
Make your own meals. Preparing meals is almost like eating.