M-code reference

M98: Subprogram call

M98 is subprogram call. Calls another program as a subprogram. It is non-modal, so it acts only on the line it is written on.

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.

TypeM-code
MachineMill and lathe
GroupProgram control
ModalNo: acts only on its own line

M98 example

M98 P2000

Run program O2000, then come back.

WordWhat it means here
M98Subprogram call
P2000a parameter: dwell time, program number, sequence number or cycle setting, depending on the code

Codes people confuse with M98

CodeWhat 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.

  • M00 Program stop
  • M01 Optional stop
  • M02 End of program
  • M30 End of program and rewind
  • M97 Local subprogram call (Haas)
  • M99 Subprogram end / return

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

  1. What does M98 do? (Mill and lathe)

  2. Which code: Calls another program as a subprogram.(Mill and lathe)

  3. What does M99 do? (Mill and lathe)

Show the answers
  1. Calls another program as a subprogram.
  2. M98
  3. Ends a subprogram and returns to the calling program.

Drill this code with the rest of the core set

More practice hubs

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.

Free preview · no card Try G-Code Sprint