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

Passing a ProDataSet parameter by binding

You can also save the overhead of copying a ProDataSet's definition and data on a local call by using the BIND keyword. Passing a ProDataSet to a local routine using the BIND keyword allows the calling routine and the called routine to access the same ProDataSet instance by:
*Binding a reference-only static ProDataSet defined in one routine to a ProDataSet instance defined in another routine
*Binding an unknown DATASET-HANDLE parameter defined in one routine to a ProDataSet instance defined in another routine
In the static case, you must define a reference-only ProDataSet in either the calling routine or the called routine by specifying the REFERENCE-ONLY keyword in the DEFINE statement for the ProDataSet.
You use the BIND keyword in both the calling and called routines to tell the AVM to bind both ProDataSet references to the same ProDataSet instance. In the calling routine, you add the keyword to the parameter in the RUN statement. This is the syntax for passing a ProDataSet using the BIND option:

Syntax

RUN internal-procedure-name IN procedure-handle
     ( [ INPUT | INPUT-OUTPUT | OUTPUT ] DATASET dataset-name BIND )
In the called routine, you specify the keyword as part of the parameter definition. This is the syntax for defining a ProDataSet parameter using the BIND option:

Syntax

DEFINE [ INPUT | OUTPUT | INPUT-OUTPUT] PARAMETER
  DATASET FOR dataset-name BIND
When you pass a ProDataSet parameter to a local routine using the BIND keyword, you can define a reference-only ProDataSet object in either the calling routine or the called routine. In either case, the reference-only object definition remains bound to the object instance until the routine containing the reference-only object definition is deleted or terminates.
The most basic case where you would want to use the BIND keyword is when you want to use the called routine's ProDataSet instance instead of the calling routine's instance.