Executing an dynamically created command

[b]can you execute a dynamically created command in naturall on runtime.
qn1. i have a map called from a pgm.
#ws-command := ‘reinput “error” mark 1 alarm’
how can i execute #ws-command on certain conditions.

qn2. can i SET KEY PF1 = ‘RUN ABC’ and the execute this from the program?

please help
cheers
[/b]

You may be able to use copycode with substitution for your first question.

For your second question, try using ‘Fetch ABC’ rather than RUN ABC.

can you give me an exemplo of how to use substitution with copycode?

include “copycode” 8)

Close, :wink:

include ‘copycode’ ‘#ws-command

then the copycode would look like:

&1&

I haven’t actually tried this so there’s no money back guarantee :lol:

cheers,

qn1. Puedes hacerlo con la instruccion “STACK TOP DATA FORMATTED #FIELD1 #FIELD2” pero el manejo es un poco complicado, dificil, no recomendable.

qn2. Yes, si puedes hacerlo.

Saludos 8)

Hi!
INCLUDE will not work.
As I think, the only time Natural parses and interprets Statements is during CATATLOG, STOW or RUN.
I know 2 ways to use this “dynamic”:

  1. Dynamic Soucecodegeneration (Filed(s) with name that starts with + in GDA; Saved program with this fields as Statments; Execute the saved Programm via “RUN”) - But this will Reset the CALL-Structure - Call Level will be 1. For example the REINPUT-statement will return Runtimeerror 1108.
    We use this only for Debugging and Access to different Databases with the same Program.
  2. Creating/Changing and Stowing Natural objects with Userexits - and then Calling them. I never tried this - and I see many troubles with it (NSC Restrictions, unique Programnames for differnt User/Sessions …)

Hello Wolfgang!

We got a related discussion in the “Open Systems Forum”.
http://natural.forums.softwareag.com/viewtopic.php?t=136

Maybe you can find something interesting there.

Regards,

Matthias