Pass a dataset within the same ABL session

When passing a dataset within the same ABL session it is common to pass the dataset by reference.

Provided a dataset was previously defined, you can define a dataset parameter by name as input, output, or input-output. The simplified syntax for defining a dataset parameter by name is:

DEFINE {INPUT|OUTPUT|INPUT-OUTPUT} 
  PARAMETER DATASET FOR dataset-name.

For example:

/* PopulateData.p */
...

DEFINE INPUT PARAMETER DATASET FOR dsOrderOrderLine. 

This statement allows the dsOrderOrderLine dataset to be passed back to the calling procedure as an output parameter.

When a procedure that runs in the same ABL session calls another procedure, passing the dataset parameter, the calling procedure specifies the BY-REFERENCE keyword. In the following example, the GetData.p procedure calls the PopulateData.p procedure:

/* GetData.p */
...

RUN PopulateData (INPUT pCriteria, INPUT DATASET dsOrderOrderLine BY-REFERENCE).

In this case, both procedures are using the same dataset object at runtime.

See also

Pass a ProDataSet parameter by binding

Pass a ProDataSet parameter by reference