Defining Subroutines/Functions

To edit code in subroutines, functions, or non-executing statements like TABLE, IOLIST, and DATA, do the following:

  1. Do one of the following:

    • On the Program menu, select Subroutines/Functions.

    • Click the drop down arrow of the Object list box and select Subroutines/Functions.

    • On the toolbar, click the Edit Subroutine button, then select a subroutine from the list, or New Subroutine/Function to create a new subroutine or function.

  2. When defining a new subroutine or function, the Name Subroutine/Function dialog appears.

    • Enter a descriptive name for this subroutine or function and click OK.

    • To define a function, enter a single or multi-line defined function according to Visual PRO/5 rules.

    • To define a subroutine, enter a unique subroutine label ending with a colon, followed by the Visual PRO/5 code that implements the subroutine, and finally a RETURN statement.

    • To define a non-executing statement, enter a unique statement label ending with a colon, followed by a TABLE, IOLIST, or DATA verb according to Visual PRO/5 rules. You can refer to this statement from elsewhere in the program by using the label (TBL=LABEL, IOL=LABEL, or RESTORE LABEL; DREAD data-list).