M98 Subprogram call
Fanuc M-code · Mill and lathe
Calls a subprogram stored in memory. The subprogram ends with M99 and returns to the next line.
Format
M98 P [L]
Addresses
| Address | What it does |
|---|---|
P | Program number to call |
L | Repeat count, 1 if left out |
How it works
Non-modal.
Example program
G00 X1.6 Z-.5 (FIRST GROOVE)
M98 P2000 L3 (RUN GROOVE SUBPROGRAM 3 TIMES)
G00 X3. (RETRACT)
M98 P2000 L3 (RUN GROOVE SUBPROGRAM 3 TIMES)
G00 X3. (RETRACT)
Example is in inch. Check offsets and clearances first.
Watch out for
- Older controls pack the repeat count into P, with 4 digits of count before 4 digits of program number.
- Subprograms can nest several levels deep. Check the limit for your control.
Related codes
M98 on other controls
The same number can mean something different on another control.
| Control | Meaning |
|---|---|
| Haas NGC | Subprogram call |
| Doosan (Fanuc) | Sub program call |
| DMG Mori MAPPS (Fanuc) | Sub-program call in NC memory |
| Mazak (EIA) | EIA → EIA Subprogram call |
| Okuma OSP | Subprogram call (Lathes & Mills) |
| Mitsubishi M70 M80 | Subprogram call |
| Brother Speedio | Subprogram call |
| Heidenhain TNC (ISO) | Machine open contours completely |
| LinuxCNC Tormach | Fanuc style subprogram call |
| Mach3 Mach4 | Subprogram call |
| Centroid CNC12 Acorn | Call subprogram |
| Hurco WinMax (NC) | Subprogram call |
| Fadal | Execute subprogram |
| Swiss (Citizen Star) | Subprogram call |
Every M-code for Fanuc in your pocket. The app has the full example programs, search by number or shop word, a line decoder and calculators for tapping, threading and drilling.
Open M98 in the app All Fanuc M-codes