The COMPILE prog (O) produces optimised runtime code from a text file written in the Pick Basic Language.
It does NOT interpret commands in the same manner in all circumstances so caution is required.
A change that caused me significant grief on switch over was ICONV where using the BASIC command trimmed leading spaces the COMPILE (O) does not.
Suddenly a program that had worked for at least 20 years unpacking a flat credit card file crashed spectacularly. The supplying company had chosen to to only use the trailing 8 characters of the credit card on a field of 16 spaces. The scream from the operator on the other side of the room as her screen sprayed up several thousand runtime errors was memorable.
210 ** SSCARD = ICONV(CSPANNUM[9,16],"MD0") works fine with the BASIC command not with COMPILE
211 SSCARD = TRIM(CSPANNUM[9,16])
212 SSCARD = ICONV(SSCARD,"MD0")
That will not be changed as the COMPILE version is technically more correct.
However a major error that was corrected many moons ago has crept back in in the latest 10... versions of D3. The COMPILE requires subroutine labels to be physically defined before they are called so
MainLine ** do major stuff
gosub 1000;* initialise
major routine
end
1000 *setup something
return
will crash. It is supposed to be fixed in the next patch. A special patch has been released for another hitch in the spooler so the current advice is use D3 9.4.2
.
I have used COMPILE (O) exclusively for the last 5 years typically by putting an O in attribute 6 which is the default in CCOMPILE that Compile calls. You can ignore the twaddle about it taking a long time with lots of levels. It goes like a rocket on Windows 10 with optimise only doing 1 level but that 1 is worth it.
I find the lower case to be extremely useful to show recent alterations as I switched to the Microsoft preferred variable style - totItems instead of TOTITEMS - some time back.