When the called routine always runs in the same session as the caller (a local call), you can avoid the overhead of copying the temp-table by passing it by reference or by binding. Both forms apply only to local calls. On a remote call, the AVM falls back to copying the temp-table.

Two parameter modifiers are available:

  • BY-REFERENCE — Passes a pointer to the caller's temp-table instance for a single call. Specify it on every RUN statement that passes the parameter. The called routine's parameter definition does not use the keyword.
  • BIND — Establishes a longer-lived association between the caller's temp-table and the called routine. Specify it on both the RUN statement and the called routine's parameter definition. When used with a persistent procedure, the binding lasts for the life of the procedure, so subsequent calls do not need to pass the temp-table again.

For details and examples, see TABLE-HANDLE form with BY-REFERENCE and TABLE-HANDLE form with BIND.

Note: When you pass temp-tables by reference or by binding, all of the possible inter-operability between static and dynamic temp-tables applies, as described in Possible combinations of temp-table parameter definitions.