Local variables range between #1 and #33. A set of local variables is available at all times. When a call to a subprogram with a G65 command is executed, local variables are saved and a new set is available for use. This is called nesting of local variables. During a G65 call, all new local variables are cleared to undefined values and any local variables that have corresponding address variables in the G65 line are set to G65 line values. Below is a table of the local variables along with the address variable arguments that change them:
Variables 10, 12, 14- 16 and 27- 33 do not have corresponding address arguments. They can be set if a sufficient number of I, J and K arguments are used as indicated above in the section about arguments. Once in the macro subprogram, local variables can be read and modified by referencing variable numbers 1- 33.
When the L argument is used to do multiple repetitions of a macro subprogram, the arguments are set only on the first repetition. This means that if local variables 1- 33 are modified in the first repetition, then the next repetition will have access only to the modified values. Local values are retained from repetition to repetition when the L address is greater than 1.
Calling a subprogram via an M97 or M98 does not nest the local variables. Any local variables referenced in a subprogram called by an M98 are the same variables and values that existed prior to the M97 or M98 call.