Previous Next

Parameter definition syntax
Defines one or more run-time parameters for a user-defined function, a class method (including a constructor), or a class event defined with an ABL method signature. ABL implements both scalar and array parameters for user-defined functions and methods of a class as NO-UNDO variables.
Syntax 
 
( parameter [ , parameter ] ... )
Note:
Use the following syntax to define each parameter, which can be a primitive, array, class, interface, temp-table, ProDataSet, or buffer:
 
Syntax 
{ INPUT | OUTPUT | INPUT-OUTPUT } 
{   parameter-name AS { primitive-type-name | [ CLASS ] object-type-name }
  | { LIKE field }
  [ EXTENT [ constant ] ] 
  | TABLE temp-table-name [ APPEND ] [ BIND ] [ BY-VALUE ]
  | TABLE-HANDLE temp-table-handle [ APPEND ] [ BIND ] [ BY-VALUE ]
  | DATASET dataset-name [ APPEND ] [ BIND ] [ BY-VALUE ]
  | DATASET-HANDLE dataset-handle [ APPEND ] [ BIND ] [ BY-VALUE ]
}
 
BUFFER buffer-name FOR database-table-name [ PRESELECT ]
INPUT | OUTPUT | INPUT-OUTPUT
Specifies the parameter mode, which determines the direction that data travels when the parameter is passed at run time. An INPUT parameter travels from the caller (source), which sets its value, to the called function or method (destination or receiver), which can use the value. An OUTPUT parameter travels from the called function or method (source), which sets its value, back to the caller (destination or receiver), which can use the value. An INPUT-OUTPUT parameter travels both ways, first from the caller, which sets its value; then to the called function or method, which can use and reset the value and pass it back to the caller, which can use the returned value.
parameter-name
Specifies the name of a primitive, class, interface, or array parameter.
AS primitive-type-name
Specifies a built-in primitive type for the parameter you are defining. The built-in data type (primitive-type-name) can be one of the following:
 
Syntax 
CHARACTER | COM-HANDLE | DATE | DATETIME | DATETIME-TZ | DECIMAL
| HANDLE | INT64 | INTEGER | LOGICAL | LONGCHAR | MEMPTR | RAW | RECID
| ROWID | AS-data-type 
If you are defining a parameter for a user-defined function, a pure ABL class method (without reference to .NET), or a class event defined with an ABL method signature, AS-data-type does not specify a valid primitive type name.
If you are defining a parameter for a method that overrides a .NET super class method (abstract or otherwise) or implements a method defined in a .NET interface, primitive-type-name must specify the exact .NET data type of the corresponding parameter in the overridden or implemented method. For a .NET mapped data type that is a default match for a given ABL primitive type, you must use the default matching ABL data type, as shown in Table 24. (For example, INTEGER indicates a .NET System.Int32.) For a .NET mapped data type that is not a default match for one of the ABL primitive types, ABL provides a data type keyword (AS-data-type) that you must use to explicitly indicate the required .NET data type, as shown in Table 25. (For example, the AS data type, UNSIGNED-BYTE, indicates a .NET System.Byte.)
Note:
At run time, a method parameter defined using an AS-data-type keyword behaves in ABL like the corresponding ABL primitive type shown in Table 25. (For example, an UNSIGNED-BYTE behaves like an INTEGER.)
Also note that when overriding or implementing a .NET array parameter, you must specify the .NET array object type (for example, "System.Int32[]" or "System.Byte[]"); you cannot use an ABL array equivalent (for example, INTEGER EXTENT or UNSIGNED-BYTE EXTENT).
AS [ CLASS ] { object-type-name }
Specifies the parameter you are defining as an object reference to a class instance. This can have the data type of a class or an interface.
object-type-name
Specifies the type name of an ABL or .NET class or interface. Specify an object type name using the syntax described in the Type-name syntax reference entry. With an appropriate USING statement, you can also specify a class or interface name alone, without the qualifying package or namespace.
You cannot directly specify the type name of a .NET mapped object type (such as System.Int32). To define a parameter that matches a .NET mapped type, you must define it as the corresponding ABL primitive type (primitive-type-name).
If you are defining a parameter for a method that overrides a .NET super class method (abstract or otherwise) or implements a method defined in a .NET interface, object-type-name must specify the exact .NET object type of the corresponding parameter in the overridden or implemented method. However, for .NET inner (nested) type, note the difference in the ABL syntax, which replaces the corresponding period (.) in the .NET object type with a plus (+) (see the Type-name syntax reference entry).
Also note that when overriding or implementing a .NET array parameter, you must specify the .NET array object type (for example, "System.Drawing.Point[]"); you cannot use an ABL array equivalent (such as System.Drawing.Point EXTENT).
CLASS
If the specified class or interface type name conflicts with an abbreviation for a built-in primitive type name, such as INT for INTEGER, you must specify the CLASS keyword.
For a class or interface return value, the AVM passes an object reference associated with the class or interface, not a class instance itself. For more information on object references, see the Class-based object reference reference entry.
LIKE field
Specifies that the parameter you are defining has the same characteristics as the variable, database field, or temp-table field designated by field.
The parameter will take on the characteristics of field. These characteristics include data type, extent, label, column-label, format, decimals, view-as and case sensitivity. One exception is UNDO, since all method and function parameters are always NO-UNDO.
You can override the extent of field by supplying your own EXTENT phrase. You cannot override any other characteristics because the only variable qualifier available in the parameter definition syntax is EXTENT.
If field is a variable or temp-table field, then it must be known by the compiler before the user-defined function, a class method, or class event you are defining can be compiled.
If field is a database field, then the database must be connected at compile time, but need not be connected at run time. You may optionally qualify a database field name with its database and/or table name.
EXTENT [ constant ]
Defines the parameter as an array of data elements with a primitive type (specified using the AS primitive-type-name option) or an object type (specified using the AS object-type-name option). This option can specify an array parameter as either determinate (has a defined number of elements) or indeterminate (has an undefined number of elements). To define a determinate array parameter, specify the EXTENT option with the constant argument. This optional argument is an integer value that represents the number of data elements in the array parameter. To define an indeterminate array parameter, specify the EXTENT option without the constant argument.
The EXTENT is part of the parameter data type. For more information, see the Type-name syntax reference entry.
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:
*
*
The AVM treats a fixed indeterminate array parameter as a determinate array parameter; that is, its size is fixed. The AVM determines the size of an unfixed indeterminate array parameter at run time.
If you are using the AS option without the EXTENT option, or you specify constant as 0, the parameter is not an array parameter.
TABLE temp-table-name
Specifies a parameter for a static temp-table.
You can pass a temp-table parameter to both local and remote user-defined functions, as well as to methods of a class. The AVM passes the parameter by value, by default. That is, the caller and the called routine each have their own instance of the temp-table. When you invoke the routine, the AVM deep-copies the parameter from one instance to the other. The table that is copied depends on whether the parameter is INPUT, OUTPUT, or INPUT-OUTPUT. When you pass a temp-table as an INPUT parameter, the AVM replaces the receiving instance with the source instance, by default. You can also append the source instance to the end of the receiving instance by specifying the APPEND option. For more information about the APPEND option, see the option description later in this reference entry.
When passing a temp-table parameter, you can override the default deep copy and pass the parameter by reference or by binding (that is, by passing the parameter using either the BY-REFERENCE or BIND option). Passing a temp-table parameter by reference or by binding allows the caller and the called routine to access the same object instance (instead of deep-copying the parameter).
For more information about passing a temp-table parameter by reference or by binding, see the Parameter passing syntax reference entry. For more information about temp-table parameters, see OpenEdge Getting Started: ABL Essentials.
TABLE-HANDLE temp-table-handle
Specifies a temp-table handle parameter.
DATASET dataset-name
Specifies a parameter for a static ProDataSet.
You can pass a ProDataSet parameter to both local and remote user-defined functions, as well as to methods of a class. The AVM passes the parameter by value, by default. That is, the caller and the called routine each have their own instance of the ProDataSet. When you invoke the routine, the AVM deep-copies the parameter from one instance to the other. The table that is copied depends on whether the parameter is INPUT, OUTPUT, or INPUT-OUTPUT. When you pass a ProDataSet as an INPUT parameter, the AVM replaces the receiving instance with the source instance, by default. You can also append the source instance to the end of the receiving instance by specifying the APPEND option. For more information about the APPEND option, see the option description later in this reference entry.
When passing a ProDataSet parameter, you can override the default deep copy and pass the parameter by reference or by binding (that is, by passing the parameter using either the BY-REFERENCE or BIND option). Passing a ProDataSet parameter by reference or by binding allows the caller and the called routine to access the same object instance (instead of deep-copying the parameter).
For more information about passing a ProDataSet object parameter by reference or by binding, see the Parameter passing syntax reference entry. For more information about ProDataSet object parameters, see OpenEdge Development: ProDataSets.
DATASET-HANDLE dataset-handle
Specifies a ProDataSet handle parameter.
APPEND
Specifies whether or not to append the data from a source instance to the receiving instance of a passed temp-table or ProDataSet parameter. To append INPUT parameter data, specify the APPEND option for the parameter in the method or user-defined function definition. To append OUTPUT parameter data, specify the APPEND option for the parameter in the method or function call.
BIND
Indicates that a TABLE, TABLE-HANDLE, DATASET, or DATASET-HANDLE parameter binds a reference-only object in one routine to an object instance defined and instantiated in another local routine.
When you define a reference-only object in the calling routine, and you want to bind that object definition to an object instance in the called routine, define the parameter by specifying the BIND option in an INPUT or INPUT-OUTPUT parameter definition. When you define a reference-only object in the called routine, and you want to bind that object definition to an object instance in the calling routine, define the parameter by specifying the BIND option in an OUTPUT parameter definition. 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.
Caution:
You can bind multiple reference-only object definitions to the same object instance. You can also bind a single reference-only object definition to the same object instance multiple times without generating an error. However, you cannot bind a single reference-only object definition to multiple object instances.
When passing one of these parameters to a remote user-defined function, the AVM ignores the BIND option and deep-copies the parameter based on the specified parameter mode.
For more information about passing these parameters by binding, see the Parameter passing syntax reference entry.
BY-VALUE
Specified for an INPUT, OUTPUT, or INPUT-OUTPUT TABLE, TABLE-HANDLE, DATASET, or DATASET-HANDLE parameter in a called routine, this option forces the parameter to be passed to the local routine by value, which overrides any BY-REFERENCE option in the corresponding routine invocation. For more information on BY-REFERENCE, see the Parameter passing syntax reference entry.
BUFFER buffer-name FOR database-table-name [ PRESELECT ]
Defines a buffer parameter, where buffer-name is the name you specify for the buffer and database-table-name is the name of a database table to which the buffer is attached. Note that database-table-name can also specify the name of a temp-table. However, if the temp-table name is identical to a database table name, all ABL references to the database table name must use fully-qualified database-name.database-table-name syntax. A buffer parameter is always INPUT-OUTPUT.
Note:
If you use the PRESELECT option and access the buffer parameter in a DO or REPEAT block, the AVM creates an internal list of the records selected. The PRESELECT option tells the AVM to apply that internal list to the buffer you define.
Note:
Notes 
*
So, overloading allows you to define multiple methods or constructors for a class definition, where all methods or constructors that have the same name all have different signatures. The signature cannot vary only by access mode or return type. If methods within a class definition differ only by their access modes or return types, ABL raises a compilation error.
*
*
*
*
*
*
*
*
See also 
CONSTRUCTOR statement, DEFINE EVENT statement, FUNCTION statement, METHOD statement, Parameter passing syntax, SUPER function, Type-name syntax, USING statement

Previous Next
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates.