hello zedodia

linear progs are more processing power efficient than parametric
depending on controller, there may exist the possibility to remove or reduce drastically this gap, thus allowing to keep the versatility of a parametric program, without infusing downtime

The prog supplied was purely for an example
somehow i was not sure about your intention, and i can't give a good advice without knowing the purpose ... i mean if i think of too many ways, i can't decide which one is better hoping that there is a 'better' way

Essentially if a have a program that cuts a square, and a macro to cut a smaller square within
for such a part, you don't need to go over nesting level 1; program would be like this :

Code:
    [ main program ]
    preparatory codes ( tool-change offset fixture rpm etc )
    call square_soubroutine var_1 = a1 var_2 = a2 ... var_n = an
    call square_soubroutine var_1 = b1 var_2 = b2 ... var_n = bn
    call square_soubroutine var_1 = c1 var_2 = c2 ... var_n = cn
    end

    [ square_soubroutine ]
    content optimized for cutting a square, using var_1, var_2 ... var_n
    end
i can try to suggest ideas, but i can't share a real solution, unless i see a real reason to pass through multi nesting levels

ok ... now, i will share an example about a code that i use, where variables are passed through levels :

Code:
    [ main program ]
    preparatory codes ( home position, fixture )
    call operation_1 var = 04
    call operation_2 var = 53
    call operation_3 var = 17
    end

    [ operation_1 ]
    call verify_offset
    call prepare_tool
    content for operation 1
    end

    [ operation_2 ]
    call verify_offset
    call prepare_tool
    content for operation 2
    end

    [ operation_3 ]
    call verify_offset
    call prepare_tool
    content for operation 3
    end

    [ verify_offset ]
    checking if offset for tool [ var ] is within some safe limits, otherwise stop the cnc
    end

    [ prepare_tool ]
    go to safe position, and index to tool [ var ]
    end
i hope that this example helps; there are also other cases when i go 'through nesting levels'

However once you get to a second level, i see no way to define the arguments unless it comes directly from the 1st layer macro
yes, this is true, but, more precise, the argument must "allready exist at 1st layer" ; this means :
... argument was created inside 1st layer ( pls check sample 1 )
... argument was created before 1st layer ( pls check sample 2 )
* another option, is that the argument is created when the 2nd soubroutine is called ( pls check sample 3 )

Code:

( sample 1 )

    [ main program ]
    call soubroutine_1
    end

    [ soubroutine_1 ]
    variable = 500
    call soubroutine_2
    end

    [ soubroutine_2 ]
    do something with 'variable'
    end

( sample 2 )

    [ main program ]
    variable = 500
    call soubroutine_1
    end

    [ soubroutine_1 ]
    call soubroutine_2
    end

    [ soubroutine_2 ]
    do something with 'variable'
    end

( sample 3 )

    [ main program ]
    call soubroutine_1
    end

    [ soubroutine_1 ]
    call soubroutine_2 variable = 500
    end

    [ soubroutine_2 ]
    do something with 'variable'
    end
The machine i have says it can go upto 16 levels of macro/subroutines. While this is good its has capability, is it really of any use?
this depends how you see things, and how far you wish to go, and how much time you have to experiment

not everybody is using soubroutines, but those ones that do it right, have more skills and more control over the machine, and their programs perform better

so far i have reached nesting level 6 or 7, but most operations are executed inside nesting level 2 or 3 i use deeper nesting levels for general soubroutines, that target optimizations that are not related to cutting; for example : checking axis positions, computing home positions, checking machine states, checking offsets, etc .... well, i have a few / kindly