I would like to know if it is possible to dynamically perform a subroutine by its name. Given a subprogram DYNSUB like the following (which doesn’t work, because PERFORM needs a constant parameter):
DEFINE DATA PARAMETER 01 #SUBROUTINE (A32) BY VALUE END-DEFINE * PERFORM #SUBROUTINE * DEFINE SUBROUTINE ROUTINE1 INPUT (AD=IO) 'in subroutine:' *CURRENT-UNIT END-SUBROUTINE * END
I would like to be able to CALLNAT it and let it perform only the subroutine with the name provided in the parameter like this:
CALLNAT 'DYNSUB' 'ROUTINE1'
I’ve already tried almost every possible way of doing that (e.g. copycodes with parameters, RUN statements with global variables) but none was sufficient for me.
To sum it up: I need a way of calling a single subroutine in a subprogram by providing the subroutine’s name in a parameter of the subprogram. And I don’t want to switch to CALLNATs with parameters, I need it for subroutines…
Could anybody please help me or at least confirm that this is not possible in Natural?