Page 1 of 1

including subs with variable names

Posted: Fri Jul 28, 2017 1:37 am
by lgehrig
Hello programmers

As I start to move subroutines out of my original program, I encountered this problem with variable subroutine names:

(The current directory is correctly set)

so this works:

Code: Select all

include MYSUB_US
but this doesnt:

Code: Select all

%Country ="US" %MYSUB ="MYSUB_"+%Country include {%MYSUB}
I get: K:\...\Code\{%MYSUB}.prg not found on disk.

Also building the filepath instead did not work. It appears file paths cannot contain replacement strings.

Does anyone know the answer?

Re: including subs with variable names

Posted: Fri Jul 28, 2017 8:07 am
by EViews Gareth
It is just as you say - you cannot dynamically include.

Re: including subs with variable names

Posted: Mon Jul 31, 2017 5:28 am
by lgehrig
Thanks for the quick answer, Gareth!