Arrays as parameters
- Last Updated: March 30, 2020
- 2 minute read
- OpenEdge
- Version 12.2
- Documentation
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.
Here is the DEFINE PARAMETER statement
syntax for defining an array as a parameter:
Syntax
|
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):
|
For more information about passing arrays as parameters see OpenEdge Programming Interfaces, ABL Reference, Web Services, Java Open Clients, and .NET Open Clients.