Hmmm ... as I recall the structure of a Pascal Program, it looks like this [...] but all procedures still have to come before the main (at least in standard Pascal ... I'm sure most people didn't write programs in purely standard Pascal).
I won't claim to remember the required structure of a Pascal program, as it's been about 10 years since I've even seen one. I do remember that I first learned about forward declarations in Pascal. *shrug* Perhaps the main *does* need to go at the end. That is where ISTR putting most of my main()s, anyway...