Subroutine name as variable?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Subroutine name as variable?

    Can you call a subroutine with a variable?

    I have several subroutines that I'd like to run from a master program. I can determine what program to run by pulling the name from an array, but can't find a way to pass that variable to my callsub.

  • #2
    You could use select and case/end_case:

    Code:
    ASSIGN/V1=1
    SELECT/V1
      CASE/1
        CS1 =CALLSUB/,SUB1.PRG:,
      END_CASE/
      CASE/2
        CS2 =CALLSUB/,SUB2.PRG:,
      END_CASE/
      CASE/3
        CS3 =CALLSUB/,SUB3.PRG:,
      END_CASE/
    END_SELECT/
    Last edited by ctw00; 01-27-2020, 12:43 PM.

    Comment


    • Stephen1055
      Stephen1055 commented
      Editing a comment
      Yes, I think this will work for what I am trying to do. Thanks.

Related Topics

Collapse

Working...
X