Haas M98 Subprogram Call: Practical Guide & Sample Code
Haas M98 Subprogram Call
Haas M98 Sub Program Call code is used to call subroutines (subprograms).
The subprogram must be in the program list, the subprogram must end with M99.
CNC machinists can even choose the number the subroutine will be repeated.
What is Sub Programming?
Subprograms are normal cnc programs which are called from a program (normally called main-program) to add some kind of repeatable machining operation.
Haas M97 Local Subprogram Call
Haas has a M97 Local-subroutine-call command to call a subroutine (subprogram) which resides inside the calling program (main-program).
Haas M97 local subprogram call (with cnc program example) has already been briefly described here Haas CNC M97 Local Sub-Program Call with CNC Program Example.

Haas CNC
What are Sub-Programs?
- CNC Subprograms Basics for CNC Machinists
- Fanuc Sub Programming
- Fanuc Subprogram Example
Haas M98 Subprogram Call Format
M98 P… L…
P – program number being called.
L – number of repetitions subprogram will be called.
As the program being called (Subprogram) must be in program list
and subprogram must end with M99.
Haas M98 Subprogram Example
O0001 (Main Program number) M98 P100 L4; (Call sub-program O0100 – repeat subprogram 4 times) M30 (End of program)
O0100 (Sub-program Number) G00 G90 G55 X0 Z0 (N line that will run after M98 P100 is run) S500 M03 G00 Z-.5 G01 X.5 F100. G03 Z... G01 X0 Z1. F50. G91 G28 Z0 G90 M99 (sub-program end, return to main-program)
CNC Machine
- Master G02/G03 Circular Interpolation in CNC: Step‑by‑Step Example
- Haas G71 Roughing Cycle Program Example for Inside Roughing
- Master Haas CNC M97 Local Sub-Program Calls: Step-by-Step Example
- CNC Programming Fundamentals: Step‑by‑Step Tutorials & Sample Code
- Basic Heidenhain Milling Program Example: Step‑by‑Step CNC Code
- Haas G150 Pocket Milling Example: CNC Program for a Square Pocket with Island
- Haas G150 Pocket Milling Program: Step‑by‑Step Example for a 5mm×5mm×0.5mm Square Pocket
- Haas G150 Pocket Milling Example: Precision Round Island Machining
- CNC Subprogram Tutorial: Using G91 Incremental Mode for Precise Z‑Axis Control
- Efficient CNC Lathe Subprogram Calls for Repeated Pattern Cutting