What is the difference between G98 and G99?+−
The height the tool comes out to after each hole of a canned cycle. With G99 it returns to the R plane, which is usually two or three millimeters off the face. With G98 it climbs to the initial plane, which is the Z the axis had when the cycle started. Both are modal and you can alternate between them from hole to hole.
Which one is active if I write neither?+−
On most Fanuc and Haas controls the power up state is G98, but that is also a machine parameter and, above all, whichever the previous program left can still be active. Always writing it in the first block of the cycle takes the doubt away and costs nothing.
How do I switch between them in the middle of a hole pattern?+−
By writing the new code in the block of the hole concerned, next to the coordinate: G98 X140. drills that hole and comes out to the initial plane. The next block can go back to G99 with no problem, because the move will already have happened at the high level.
Do G98 and G99 mean the same thing on a lathe?+−
No. On Fanuc A system lathes and on Haas lathes they are the feed modes: G98 per minute and G99 per revolution. It is the same pair of codes with a different meaning, so a block copied from a mill to a lathe changes the feedrate instead of the return height.
Do they exist on Siemens or Heidenhain?+−
As codes, no. Siemens defines the two heights inside the cycle with the RTP and RFP parameters, and Heidenhain with Q200 (set-up clearance) and Q204 (second set-up clearance). The concept is identical: a short height to move fast and a high one to clear obstacles.