0

I need to pass the name of a Clarion routine to a Variable and run it.

E.g:

!************************

RoutineName='CalculateSomething'

DO RoutineName

!************************

It does not work in this format so I've also tried other characters (brackets, quotations etc) before and after the variable. No luck.

Please note that the Routine 'CalculateSomething' exists and runs fine with the basic command:

!************************

DO CalculateSomething

!************************

SQLsavvy
  • 25
  • 4

2 Answers2

0

How about using a case statement to do this?

RoutineName='CalculateSomething'

CASE RoutineName
OF 'CalculateSomething'
  DO CalculateSomethingRoutine
OF 'SomethingElse'
  DO SomethingElseRoutine
ELSE
  Stop('Unknown routine named: ' & RoutineName)
END
brahnp
  • 2,276
  • 1
  • 17
  • 22
  • Unfortunately there are a LOT of routines involved and I want to avoid hard-coding names. The variable get sent to the Global Data Processing application from other applications via the "command" line therefore the most compact solution would involve using the variable as received. – SQLsavvy Oct 23 '17 at 16:49
0

I think there no option like that on the Clarion programing language.

The only way that I suggest to CASE statement like that:

RoutineName='CalculateSomething' 

    CASE UPPER(RoutineName)  
    OF 'CALCULATESOMETHING' 
        DO CalculateSomething
    OF 'CALCULATESOMETHINGELSE' 
        DO CalculateSomethingElse 
    OF 'CALCULATENOTHING'
        DO CalculateNothing 
    END 
Y. M.
  • 107
  • 9