Graham,
I typed your code into 'Notepad' and loaded it into Mach3.
I have tried your code, ie simulated in Mach3, and of cause it worked fine in single stepping and normal run mode though the graphics showed it cutting the same part twice despite the G52 shift of origin (expected).
I then typed in my code, very similar to yours, but it would not jump into the subroutine!.
Checked it in 'Word' and all carriage returns seemed OK.
Tried various changes to the code but without success so getting quite frustrated.
Will hopefully attache my code and I wonder if you could look at it and let me know what the problem is.
Malcolm Smith