Flávio Lúcio Na... · May 19, 2021

Variable <Undefined> using Xecute command

Hello everyone,


I have a question, I am trying to use xecute command, but something wrong happen when i was using the command, and i don't know why hahahaha.

I created a file .mac with this code:

label(test) public{
       set routine="variable"
       set call="write routine,!"
       xecute call

But when i run the command, show me this message error:

<UNDEFINED>label+3^tstFJR3 *routine

After that i changed the code to:

      set routine="variable"
      set call="write routine,!"
      xecute call

This solved the problem to me, and writed this content:


Someone can explain to me, why this happend? 

0 161
Discussion (4)2
Log in or sign up to continue

First off, it's generally best to avoid xecute. ;)

In the first case, routine is private (it isn't visible in the xecute stack frame). In the second, it's public, so it is visible there.

You could get the best of both worlds with:

ClassMethod Run()
   set routine="variable"
   set call="(routine) write routine,!"
   xecute (call, routine)

For more info see

I understand, but the text "public" below, don't should solve the problem of visibility?

label(test) public{

This is only for external access to this label, without it, you would not be able to call this from terminal or from another routine or class.

Curly braces makes it private by stack. 

Xecute and indirection (@) are outside of the scope of a procedure.

Change the label to:

label(test) [routine] public

Where [...] is the public-list, those variables are available outside the scope of a procedure.

If you leave out the procedure brackets, all variable are 'globally' availabe.