M98: Subprogram call
What M98 does
M98 runs another program, named with P, and returns when that program reaches M99. Repeated features such as a hole pattern or a pocket are written once and called several times.
| Type | M-code |
|---|---|
| Machine | Mill and lathe |
| Group | Program control |
| Modal | No: acts only on its own line |
M98 example
M98 P2000 Run program O2000, then come back.
| Word | What it means here |
|---|---|
M98 | Subprogram call |
P2000 | a parameter: dwell time, program number, sequence number or cycle setting, depending on the code |
Codes people confuse with M98
| Code | What it does instead |
|---|---|
M99 | Subprogram end / return. Ends a subprogram and returns to the calling program. |
G65 | Macro call. Calls a macro program and passes it arguments. |
M97 | Local subprogram call (Haas). On Haas, calls a subprogram at an N line inside the same program. |
Other codes in the program control group
These also act only on their own line.
Meanings follow the common Fanuc-style standard that Haas, Okuma (EIA mode), Mitsubishi, LinuxCNC and most other controls share for this code. Options and parameters change details from machine to machine, so check the manual for your control.
Quick check: M98
-
What does
M98do? (Mill and lathe) -
Which code: Calls another program as a subprogram.(Mill and lathe)
-
What does
M99do? (Mill and lathe)
Show the answers
- Calls another program as a subprogram.
- M98
- Ends a subprogram and returns to the calling program.
Frequently asked questions
- What does M98 mean in CNC programming?
- Subprogram call. Calls another program as a subprogram.
- Is M98 modal?
- No. M98 acts only on the line where it is written; the next line goes back to whatever modal codes were already active.
- What is the difference between M98 and M99?
- M98 (subprogram call): calls another program as a subprogram. M99 (subprogram end / return): ends a subprogram and returns to the calling program.
- What is the difference between M98 and G65?
- M98 (subprogram call): calls another program as a subprogram. G65 (macro call): calls a macro program and passes it arguments.
G-Code Sprint is an educational practice tool only. It is not a CNC simulator, machine controller, safety manual, or replacement for instruction. Always follow your instructor, employer, machine manual, and shop procedures.