My daughter has experienced very similar things.
The most vital thing you can do right now is to start a food journal. I suggest getting a simple notebook or legal pad, and use one page for each day.
Write down the date, and then write down any foods or drinks your son consumes. Be specific. (I know, I've written this advice before, but it's important). Do not write: lunch. Write: 1 red apple, 1 sandwich made from two slices of white bread and two slices of deli ham and 1 slice of American cheese. 1 diet Coke. Or whatever lunch was. Don't write: supper. Write: Spaghetti with Prego mushroom sauce and Kraft parmesan cheese, or spaghetti with homemade marinara sauce made with fresh tomatoes and onions and garlic, and two slices of Pepperidge Farm garlic toast.
Note all the little things, like gum, or a candy bar. And get him involved. If he grabs a banana or a drink of juice, have the notebook open in a convenient place and teach him to write it down.
Do the same for snacks, breakfasts, suppers, etc. Keep the list in some kind or order, like starting at the top for breakfast, and going down the page as the day progresses.
Then, when he feels pain, put some kind of mark on the page. Like a red X. Mark the X next to the time of day when he felt the pain.
You may see something pop out at you. The marks may coincide with a particular food or food group.
And, does he eat anything that is sugar-free, "diet", artificially sweetened? Anything containing xylitol, mannitol, sorbitol, erythritol?
This journal thing is especially important to start NOW since you have a GI appointment next week.
My daughter turned out to be extremely intolerant to certain fruits, and she's severely allergic to quinoa (I know, right? Who's allergic to that? She is.) We read labels like crazy and avoid those fruits strictly. No sugar free stuff EVER, and no processed foods.
I hope you can figure out what's bothering your son soon. It's frustrating, I know.