Try OpenEdge Now
skip to main content
ProDataSets
ProDataSet Parameters : Passing a ProDataSet as a parameter
 

Passing a ProDataSet as a parameter

You can pass a static ProDataSet as a static object using the PARAMETER DATASET form, which is similar to the PARAMETER TABLE form for a temp-table. Also, you can pass either a static or dynamic ProDataSet through its handle using the PARAMETER DATASET-HANDLE, which is similar to the PARAMETER TABLE-HANDLE form for temp-tables.
The DATASET parameter form passes a ProDataSet as a static object to another procedure in the same session or another session. This is the syntax for a parameter definition of this form:

Syntax

DEFINE [ INPUT | OUTPUT | INPUT-OUTPUT] PARAMETER DATASET FOR dataset-name
  [ APPEND ] [ BIND ].
This is the syntax for a parameter passed in a RUN statement:

Syntax

RUN procedure ( [ INPUT | OUTPUT | INPUT-OUTPUT ] DATASET dataset-name
  [ APPEND ] [ BY-VALUE | BY-REFERENCE | BIND ] ).
The DATASET-HANDLE form passes the ProDataSet as a dynamic object through a handle variable. This is the syntax for a parameter definition of this form:

Syntax

DEFINE [ INPUT | OUTPUT | INPUT-OUTPUT ] PARAMETER DATASET-HANDLE handle-var
  [ APPEND ] [ BIND ].
This is the syntax for a parameter passed in a RUN statement:

Syntax

RUN procedure ( [ INPUT | OUTPUT | INPUT-OUTPUT ] DATASET-HANDLE handle-var
  [ APPEND ] [ BY-VALUE | BY-REFERENCE | BIND ] ).
You can pass a ProDataSet statically from one procedure using the DATASET parameter form, and receive it in another procedure in the same session or another session as a dynamic object using the DATASET-HANDLE parameter form, and vice versa.
For example, this technique allows you to take a statically defined ProDataSet on the server and pass it to a general-purpose client procedure that:
*Receives it dynamically through a DATASET-HANDLE
*Analyzes its structure through the handle
*Browses or otherwise uses the ProDataSet and its contents using dynamic client-side objects
A static definition is most useful on the server because it allows static business logic to operate directly on the ProDataSet and its temp-tables.
A ProDataSet can also be passed just as a handle using the HANDLE parameter type. As with other objects, a ProDataSet can be passed by a simple reference to its handle only within the same session, and can be accessed only dynamically, that is, through the handle, in the receiving procedure.