FANUC codes
FANUCProgram/G-codeIntermediate5-30 minutes

107

Fanuc 107 - Undefined macro variable

UNDEFINED MACRO VARIABLE

Fanuc PS program alarm 107: UNDEFINED MACRO VARIABLE. This alarm is triggered by an illegal or incorrectly formatted command in the part program, or a programming condition that the Fanuc control cannot execute.

Root Cause Summary

Alarm 107 occurs when the CNC program attempts to read or use a macro variable that has not been assigned a value. This is most commonly caused by referencing an empty variable in calculations, conditional statements, or as a parameter before it has been initialized with a value.

Safety

  • Verify corrected program or parameters before resuming machining

Causes and Fixes

  1. 1

    Identify the line number where the alarm occurred by checking the alarm screen or program stop position.

  2. 2

    Review the macro variable numbers being used in that line and surrounding blocks (look for # symbols followed by numbers).

  3. 3

    Trace back through the program to verify each variable is assigned a value (e.g., #100=50) before it is used in calculations or addresses.

  4. 4

    Add initialization statements at the program start or before first use (e.g., #100=0) or verify the variable should have been set by a previous operation.

    Ensure initialized values are appropriate for the machining operation to avoid crashes or incorrect tool movements.

Service Recommended confidence

Seeing Multiple Alarms?

Seeing another alarm with this one? Enter the code.

Get machine-aware diagnosis

AxisMD logs alarms against your actual machines, tracks patterns, and gives AI context your manual doesn't have.

Start free

Was this guide helpful?

Always verify with your machine manual or a certified technician before performing service procedures.