Procedure Step

This describes adding and configuring a new procedure.

A procedure step contains one or more steps that can be re-used within the same script or across multiple scripts. You could, for example, define a procedure and run it repeatedly within a script, each time with different arguments.

Running a procedure is done using the RunProcedure control statement.

New Procedure Step

To add an empty procedure step:

  1. While in the Script Steps pane, click the Add new procedure... toolbar button.
  2. An empty procedure body containing the Procedure and EndProcedure keywords is added to the bottom of the steps table and can be populated subsequently with script statements.
  3. The Procedure statement is highlighted light green such as to permit visual delimitation from the script body, as shown in the figure below:

  4. Double-click the Procedure statement to access the Step Configuration wizard, navigate to the Properties page and specify the following parameters:
    • Procedure name: A name the procedure will be referenced by in a
      RunProcedure step.
    • End action: For procedures that spawn parallel threads, this option specifies an action to be taken at the end of the procedure with regard to the spawned threads. This command could prove useful, for example, to terminate all spawned threads that were not explicitly joined within the procedure using a Join statement.
    • The following options are available:

      • Take no action: No specific action with regard to spawned procedures is taken at the end of the procedure execution.
      • Wait for active parallel steps to complete: Choosing this option results in waiting for any parallel steps to finish when the end of the procedure is reached.
      • Abort pending parallel steps: Choosing this option results in forcibly terminating any parallel steps that are still running when the end of the procedure is reached.
      • Click Next.

  5. Specify the procedure arguments by clicking the button and defining for each argument a name, a type (String, Numeric, or Composite), a default value, and an optional description.
  6. Composite procedure arguments cannot be set to default values.

    When the arguments list contains more than one entry, you can change the arguments position by clicking the arrow buttons.

    Click Next.

  7. Specify the procedure output by defining the following parameters:
    • Return type: The procedure result type, which can be either of the following: None, String, Numeric, or Composite.
    • Default value: The default return value needs specified in case you have chosen a Numeric or a String return type.
    • Click Next.

  8. Verify the step summary information and revert to a previous configuration step if needed. Click Finish.

Example:

Procedure P {Numeric:a Composite:b}
    Trace ${b.target_1}
    Return $a
    EndProcedure