M-code reference

M97: Local subprogram call (Haas)

M97 is local subprogram call (Haas). On Haas, calls a subprogram at an N line inside the same program. It is non-modal, so it acts only on the line it is written on.

What M97 does

M97 is a Haas code that jumps to a sequence number in the same program and returns at M99. Fanuc controls use M98 with a separate program instead.

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

M97 example

M97 P1000 L2

Run the routine at N1000 twice.

WordWhat it means here
M97Local subprogram call (Haas)
P1000a parameter: dwell time, program number, sequence number or cycle setting, depending on the code
L2repeat count, or which data table G10 writes

Codes people confuse with M97

CodeWhat it does instead
M98 Subprogram call. Calls another program as a subprogram.

Where controls differ

  • Haas: Haas specific.

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
  • M98 Subprogram call
  • 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: M97

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

  2. Which code: On Haas, calls a subprogram at an N line inside the same program.(Mill and lathe)

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

Show the answers
  1. On Haas, calls a subprogram at an N line inside the same program.
  2. M97
  3. Calls another program as a subprogram.

Drill this code with the rest of the core set

More practice hubs

Frequently asked questions

What does M97 mean in CNC programming?
Local subprogram call (Haas). On Haas, calls a subprogram at an N line inside the same program.
Is M97 modal?
No. M97 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 M97 and M98?
M97 (local subprogram call (Haas)): on Haas, calls a subprogram at an N line inside the same program. M98 (subprogram call): calls another program as a subprogram.

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