PARAMETERS Command

Example   See Also

Assigns data passed from a calling program to private variables or arrays.

Syntax

PARAMETERS ParameterList

Arguments

ParameterList

Specifies the variable or array names to which the data is assigned.

Parameters within ParameterList are separated by commas. There must be at least as many parameters in the PARAMETERS statement as in the DO ... WITH statement. If more variables or arrays are listed in the PARAMETERS statement than are passed by DO ... WITH, the remaining variables or arrays are initialized to false (.F.). A maximum of 27 parameters can be passed.

PARAMETERS( ) returns the number of parameters that were passed to the most recently executed routine.

Remarks

When PARAMETERS is used with DO ... WITH, it must be the first executable statement in the called program, procedure, or user-defined function.

By default, DO ... WITH passes variables and arrays to procedures by reference. When a value is changed in the called procedure, the new value is passed back to the associated variable or array in the calling program. If you want to pass a variable or array to a procedure by value, enclose the variable or array in parentheses in the DO ... WITH parameter list. Any changes made to the parameter in the called procedure are not passed back to the calling program.

Variables are by default passed by reference to a procedure and by value to a user-defined function. Use SET UDFPARMS TO REFERENCE to pass variables to a user-defined function by reference.