SET-PARAMETER( ) method (Handle)
- Last Updated: May 20, 2024
- 3 minute read
- OpenEdge
- Version 12.8
- Documentation
Lets you set parameters for one of the following:
- A procedure or user-defined function you want to invoke dynamically
- A Windows DLL routine or UNIX shared library routine you want to invoke dynamically
- An attribute you want to get or set dynamically
- A method you want to invoke dynamically
Return type: LOGICAL
Applies to: Call object handle
Syntax
|
- parameter-number
- An integer expression indicating the order of the parameter. Use 1 for the first parameter, 2 for the second parameter, and so on.
- data-type
- A character expression indicating the data type of the parameter and
evaluating to one of the following:
"CHARACTER""COM-HANDLE"Note: The"COM-HANDLE"data type is not supported when calling a DLL routine."DATASET-HANDLE""DATE""DATETIME""DATETIME-TZ""DECIMAL""HANDLE""INT64""INTEGER""LOGICAL""LONGCHAR""MEMPTR""RAW""ROWID""TABLE-HANDLE"
TABLE-HANDLEcan be a handle to a static or dynamic temp-table. Likewise,DATASET-HANDLEcan be a handle to a static or dynamic ProDataSet object.As with non-dynamic programming, you cannot pass a BLOB or CLOB as a parameter to a method.
To manage BUFFER parameters, use
HANDLEparameters.For each parameter, the data type specified by the caller and the callee must be compatible. For example, an ABL application must specify a 64-bit ABL data type (INT64) when calling a DLL routine that expects a 64-bit signed integer. The ABL program cannot declare the ABL variable as LONG or UNSIGNED-LONG and expect the correct behavior. Similarly, if a DLL routine expects a 32-bit value, the ABL program must specify a 32-bit ABL data type (LONG or UNSIGNED-LONG). The ABL program cannot declare the ABL variable as a SHORT or UNSIGNED-SHORT and expect the correct behavior.
When invoking a Windows DLL or UNIX shared library function, ABL DLL data types are valid as data-type values. data-type specifies the type expected by the DLL or shared library routine parameter. For example, the parameter data-type is set to
"LONG"if the DLL routine parameter expects"LONG". For a list of valid ABL DLL data types, see the DEFINE PARAMETER statement.If a DLL data type is specified for a non-DLL invocation, the AVM raises a run-time error.
CAUTION: For CHARACTER parameters, the AVM always passes the routine a pointer to the character or character string value rather than the value itself. If the routine modifies the value, it can also modify the AVM memory outside the bounds of the CHARACTER value with unpredictable results. For this reason, ABL does not allow you to useOUTPUTorRETURNfor CHARACTER or LONGCHAR parameters, as well as CHARACTER or LONGCHAR array parameters, and does not recommend you useINPUT-OUTPUTfor CHARACTER or LONGCHAR parameters. Rather, pass the character string as a MEMPTR parameter. For more information, see OpenEdge Programming Interfaces.Note: If you pass an ABL character string to a UNIX shared library routine, you can pass it as a CHARACTER variable or expression. However, if you expect the shared library routine to modify the value, Progress Software Corporation recommends that you pass a MEMPTR containing a null-terminated character string. - iomode
- A character expression indicating the mode of the parameter and
evaluating to one of the following:
"INPUT""OUTPUT""INPUT-OUTPUT""OUTPUT-APPEND"
For each parameter, the mode specified by the caller and the callee must match.
For parameters of attributes, specify
"INPUT".For
TABLE-HANDLEoutput parameters whose output is to be appended to the table, and in no other case, specify"OUTPUT-APPEND".If data-type is
"DATASET-HANDLE"or"TABLE-HANDLE", you can append"-by-reference"to any previously listed iomode. - parameter-value
- An expression whose type is compatible with data-type.
The parameter-value argument may represent a determinate or indeterminate array. However, you cannot pass an array by value. You can pass an array only as a variable defined using the
DEFINE VARIABLEstatement with theEXTENToption. If you include theEXTENTkeyword in the data-type argument, the AVM ignores it. If you include the array element values in the parameter-value argument, ABL generates a compile error.If iomode is
"INPUT"or"INPUT-OUTPUT", if the data type of parameter-value does not agree with the data type passed, parameter-value will automatically be converted to the data type passed duringSET-PARAMETER()processing.If iomode is
"OUTPUT"or"INPUT-OUTPUT", each of the following must be true:- parameter-value must
represent a program variable or a
NO-UNDOtemp-table field (perhaps with an array reference). - parameter-value must still be in scope and must still be valid when the dynamic invoke is executed.
- If the output value from the called procedure does not have a data type that matches the data type passed, the output value will be converted to the data type passed.
If iomode is
"OUTPUT", parameter-value is ignored if theASYNCHRONOUSattribute is TRUE. - parameter-value must
represent a program variable or a