When a part program hangs at an M code it usually means either the option is not enabled and/or not programmed into the machine control, or if the M function is installed, the operation cannot complete due to the mechanical process unable to perform as required.
Is the book you refer to the Fanuc manual or the Machine tool manual, the latter is the one that should indicate if the option is present and how to use it. The Fanuc manual is just generic operation.
Al.
CNC, Mechatronics Integration and Custom Machine Design
“Logic will get you from A to B. Imagination will take you everywhere.”
Albert E.