Dynamic calls

Hi all,

Is there a way to make dynamic calls in Natural?. These are my needs:

A client sends a request specifying the program (or Subprogram) he wants to call, followed by the data the program needs to process that request (so the length of this data is variable).

Another problem is that we want to reuse existing programs, so we want to minimize (even avoid if possible) the changes in the existing programs.

How can I accomplish this?


In Natural you may specify the object you wish to transfer control to “implicitly”, rather than just explicitly.

In other words, you may say FETCH #PROGRAM as well as FETCH ‘MYPROG’.

What is not clear is how the data is being sent from the client. I will assume that there is some way you can “parse” this data. For example, the data might have commas as delimiters. Then you could SEPARATE #CLIENT-DATA INTO appropriate other fields.

#CLIENT-DATA should probably be defined as (A) DYNAMIC to accomodate the variability you expect.

I would first identify the program (subprogram) that is to be invoked. Then you might have something like a DECIDE statement based on the object name, or a series of IF’s such as:


If you do this for all the possible objects, you should not have to change the objects themselves.