The code you posted looks okay, with the possible exception of the "g40.1" command at the beginning, which I'm not familiar with - you can eliminate it and see if anything improves.
What happens if you go to Mach3's MDI (Manual Data Input) screen and, starting from X0, give it a command like "G0 X2" ? Does it move 2 inches, or 2 mm? If it's the latter, then you may have the wrong settings in Config/motor tuning/ "steps per unit". If you tell us what kind of a machine you've got, the pitch of the screws, type of motors, and what drivers you're using, we might be able to get that straightened out.
If the machine moves 2 inches in MDI mode when you tell it to, but still won't run a program correctly, then we need to look harder at your settings.
Andrew Werby
www.computersculpture.com