Try OpenEdge Now
skip to main content
ABL Data Types Addenda
Arrays : Arrays as parameters
 

Arrays as parameters

Starting with OpenEdge Release 10, you can pass arrays as run-time parameters. Starting in OpenEdge Release 10.2A, you can return arrays from class-based methods and user-defined functions. This feature enables applications developed in ABL to be more compatible with non-ABL applications which expose arrays in their interfaces.
Note: In OpenEdge Release 10.2A, class properties and public data members can now be arrays and defining an instance of a class with the EXTENT option results in an array of handles to that class.
Here is the DEFINE PARAMETER statement syntax for defining an array as a parameter:

Syntax

DEFINE { INPUT | OUTPUT | INPUT-OUTPUT }
  parameter-name AS data-type EXTENT [expression ] . . .
You can define an array parameter as either determinate (has a fixed number of elements) or indeterminate (has an undefined number of elements). To define a determinate array parameter, specify the EXTENT option with the expression argument. This optional argument evaluates to an integer value that represents an extent for the array parameter. To define an indeterminate array parameter, specify the EXTENT option without the expression argument.
An indeterminate array parameter can be in one of two states: fixed or unfixed, meaning it either has a fixed dimension or it does not. An indeterminate array parameter has an unfixed dimension when first defined. You can fix the dimension of an unfixed indeterminate array parameter by:
*Passing the array parameter to a routine whose corresponding parameter is a determinate array
*Setting the number of elements in the array parameter using the EXTENT statement
ABL treats a fixed indeterminate array parameter as a determinate array parameter; that is, its size is fixed. ABL determines the size of an unfixed indeterminate array parameter at run time.
The EXTENT function returns the size of (the number of elements in) an array field or variable. For example, the following code example returns 12 (the extent of the Mnth-Sales field is 12):
FIND FIRST Customer.
DISPLAY EXTENT(Customer.Mnth-Sales).
For more information about passing arrays as parameters see OpenEdge Development: Programming Interfaces, OpenEdge Development: ABL Reference, OpenEdge Development: Web Services, OpenEdge Development: Java Open Clients, and OpenEdge Development: .NET Open Clients.