>>cPrgFile = "c:\temp\common\sql.prg"
>>do (cPrgFile)
>
>To explain the "why" of Al's answer, although it might be obvious, the FoxPro has to be installed to DO a prg. The runtime will just be able to do already compiled code. Hence the COMPILE command. Which I think was awfully nice of Microsoft to give us (that was VFP 6.0 SP 3, I believe).
When this feature came up, I couldn't believe my eyes. It was something I wished since quite a number of versions.
Nowadays, I'm storing procedures in memo fields and unpacking them as needed (timestamp checking). Furthermore, I'm doing a heavy import procedure, where a bunch of things should be optional or configurable - so instead of doing a bunch of checks for each field of each record, I do most of them at the beginning (once I have the intermediate table full, and the configuration set), and generate a routine which will process one record exactly as specified. Skip some method calls, insert others, call the methods with a certain parameter etc. My estimate is that I've saved few tens of thousands of IF statements of IIF functions. Such a thing wasn't feasible without the generate-compile-run cycle being available in the runtime.