Try OpenEdge Now
skip to main content
ProDataSets
ProDataSet Parameters : Passing a ProDataSet with BY-REFERENCE or BIND
 

Passing a ProDataSet with BY-REFERENCE or BIND

Similarly to how temp-tables are passed as parameters, the AVM passes the ProDataSet by value, by default. That is, the AVM copies the ProDataSet definition and all the data in its temp-tables from one procedure to the other. This is true whether the call is to another procedure in the same OpenEdge session, or in a separate OpenEdge session on the other side of an AppServer connection. The overhead of doing this can be quite high and should be avoided wherever possible.
When you pass a ProDataSet to a remote session, the AVM has no choice but to copy the data from one session to the other. However, when you pass a ProDataSet as a parameter locally, you can optimize the call by including the BY-REFERENCE or BIND keyword on the parameter in the RUN statement, as shown in the following syntax examples:

Syntax

RUN procedure ( [ INPUT | OUTPUT | INPUT-OUTPUT ] DATASET dataset-name
  [ APPEND ] [ BY-VALUE | BY-REFERENCE | BIND ] ).

Syntax

RUN procedure ( [ INPUT | OUTPUT | INPUT-OUTPUT ] DATASET-HANDLE handle-var
  [ APPEND ] [ BY-VALUE | BY-REFERENCE | BIND ] ).
Passing a ProDataSet to a local routine using the BY-REFERENCE or BIND keyword allows the calling routine and the called routine to access the same ProDataSet instance, instead of copying the ProDataSet, and thereby provides a significant performance advantage.
When the call is remote, the AVM ignores the BY-REFERENCE and BIND keywords and passes the ProDataSet by value, as it must in this case.
For more information about using the BY-REFERENCE and BIND keywords, see the parameter definition syntax and parameter passing syntax reference descriptions in the OpenEdge Development: ABL Reference.
* Passing a ProDataSet parameter by reference
* Passing a ProDataSet parameter by binding