Using mode options for method parameters
- Last Updated: January 17, 2024
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
The default mode for a method parameter is input. An input parameter passes a value to the method but does not return a value from the method. Thus, an input parameter can be a database field, an expression, or a variable.
INPUT keyword
as a mode option because, for a parameter, ABL might interpret this
as the screen value of a widget.The mode option OUTPUT or INPUT-OUTPUT specifies
a parameter that returns a value from the method. (An INPUT-OUTPUT parameter
also passes a value to the method.) This means that the value of
any passed variable can change after the method call returns. You
can only specify the OUTPUT or INPUT-OUTPUT options with
a variable as the parameter (as opposed to a database field or an
expression):
|
OUTPUT or INPUT-OUTPUT option
forces the parameter to be passed as a pointer and explicitly specifies
that a value be returned to your application. Thus, if you use a
mode option, you do not need to use the BY-POINTER type
option because the type option is redundant. However, the BY-POINTER type
option, by itself, does not return a value to your program. You
must use a mode option or ABL does not allow the method to return
a value in the parameter.Note that ABL does not use Type Library information to determine the parameter mode. This prevents the COM object from updating a variable that you do not expect or want to change. Thus, if the COM object ordinarily changes the value of a particular parameter, you can prevent any variable you pass from having its value changed by omitting any mode option on the parameter.