Release 10.1A: OpenEdge Development:
Progress 4GL Reference

> ## Parameter passing syntax

> This syntax specifies one or more parameters to pass to a Progress procedure, a user-defined function, or a method within a class (including a constructor method when instantiating a class object instance using the NEW statement).

> `( `parameter` [, `parameter` ] ... )`

> Use the following syntax to specify each `parameter`:

> Syntax
>     INPUT | OUTPUT | INPUT-OUTPUT
>      {  expression
>       | parameter-name AS data-type
>       | parameter-name AS [ CLASS ] { type-name }
>       | { {  TABLE temp-table-name
>             | TABLE-HANDLE temp-table-handle
>             | DATASET dataset-name
>             | DATASET-HANDLE dataset-handle
>            } [ APPEND ] [ BY-VALUE | BY-REFERENCE | BIND ]
>          }
>      }

>     BUFFER buffer

> `INPUT | OUTPUT | INPUT-OUTPUT`

> The parameter mode. The default mode is INPUT.

> ``expression``

> A constant, expression, field name, or variable name. A constant or expression can be only an INPUT parameter. A field name or variable name, which can receive a value, can be an OUTPUT or INPUT-OUTPUT parameter.

> ``parameter-name``

> The name of the parameter.

> `AS `data-type``

> The data type of the parameter.

> `AS [ CLASS ] { `type-name` }`

> Specifies a class or interface parameter. Progress passes the object reference associated with the class or interface (by value), not the class or interface itself.

> ``type-name``

> A character string that specifies the type name of a class or interface. Specify a type name using the `package`.`class-name` syntax as described in the Type-name syntax reference entry in this book.

> If the specified class or interface type name conflicts with an abbreviation of a built-in Progress data type name, such as INT for INTEGER, you must specify the CLASS keyword.

> `TABLE `temp-table-name``

> The name of a temporary table.

> `TABLE-HANDLE `temp-table-handle``

> A handle to a temporary table.

> Use a temporary table handle as a parameter for a dynamic temp-table object. The definition behind the handle and the contents of the temp-table are sent. The matching parameter definition for the temp-table handle may be either the dynamic TABLE-HANDLE option or the static TABLE option.

> If you call a remote procedure asynchronously and pass a parameter as OUTPUT TABLE-HANDLE `temp-table-handle` APPEND, the event procedure must specify a corresponding DEFINE INPUT PARAMETER TABLE-HANDLE FOR `temp-table-handle` APPEND statement, and `temp-table-handle` must be global to both the calling procedure and the event procedure.

> `DATASET `dataset-name``

> The name of a ProDataSet object.

> `DATASET-HANDLE `dataset-handle``

> A handle to a ProDataSet object.

> Use a ProDataSet object handle as a parameter for a dynamic ProDataSet object. The definition behind the handle and the contents of the ProDataSet object are sent. The matching parameter definition for the ProDataSet object handle may be either the dynamic DATASET-HANDLE option or the static DATASET option.

> `BUFFER `buffer``

> The name of a buffer.

> Note: You cannot pass BUFFER parameters to a remote procedure.

> `APPEND`

> Specifies whether or not to append the traveling temporary table data to the stationary temporary table data. To append output parameter data, specify the APPEND option in the RUN statement. To append input parameter data, specify the APPEND option in the DEFINE PARAMETER statement.

> `BY-VALUE | BY-REFERENCE | BIND`

> Specifies whether to pass a TABLE, TABLE-HANDLE, DATASET, or DATASET-HANDLE parameter by value, by reference, or by binding. The default is BY-VALUE.

> You can pass TABLE, TABLE-HANDLE, DATASET, and DATASET-HANDLE parameters to both local and remote procedures. These parameter types are normally passed by value, by default. That is, the calling routine and the called routine each have their own instance of the object, and the parameter is deep-copied from the calling routine’s instance to the called routine’s instance.

> When passing one of these parameters to a local routine, you can override the default in the calling routine by specifying the BY-REFERENCE or BIND option.

> Passing one of these parameters to a local routine using the BY-REFERENCE option allows the calling routine and the called routine to access the same object instance. That is, both routines access the calling routine’s instance and ignore the called routine’s instance. Since the called routine’s object instance is ignored, you should define the static object as reference-only by specifying the REFERENCE-ONLY option in the DEFINE statement for the object.

> Passing one of these parameters to a local routine using the BIND option allows the calling routine and the called routine to access the same object instance. You can do this by:

> - Binding a reference-only static object defined in one routine to an object instance defined in another routine.
> - Binding an unknown TABLE-HANDLE or DATASET-HANDLE parameter defined in one routine to an object instance defined in another routine.

> In the static case, you must define a reference-only object in either the calling routine or the called routine by specifying the REFERENCE-ONLY option in the DEFINE statement for the object. You must also define the parameter by specifying the BIND option in the DEFINE PARAMETER statement.

> When you define a reference-only object in the calling routine and pass it to the called routine using the BIND option, Progress binds the definition of the object in the calling routine to the object instance in the called routine. When you define a reference-only object in the called routine and receive the object from the calling routine, Progress binds the definition of the object in the called routine to the object instance in the calling routine. 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: Do not delete the object or routine to which a reference-only object is bound, or you might be left with references to an object that no longer exists.

> 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 procedure, Progress ignores the BY-REFERENCE and BIND options and deep-copies the parameter based on the specified parameter mode.

> Note: You cannot pass DATASET or DATASET-HANDLE parameters to an asynchronous remote procedure.

> For more information about passing parameters to both local and remote procedures, see OpenEdge Development: Progress 4GL Handbook .

> #### See also

> FUNCTION statement, NEW statement, PUBLISH statement, RUN statement, RUN SUPER statement, SUPER( ) method, SUPER system reference

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095