LPARAMETERS Command

See Also

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

Syntax

LPARAMETERS ParameterList

Arguments

ParameterList

Specifies the local 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 LPARAMETERS statement as in the DO ... WITH statement. If more variables or arrays are listed in the LPARAMETERS 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.

You can use PARAMETERS( ) to determine the number of parameters passed to the most recently executed program, procedure, or user-defined function.

Remarks

LPARAMETERS creates local variables or arrays within a called program, procedure, or user-defined function. Use PARAMETERS to create private variables or arrays.

LPARAMETERS must be the first executable statement in the called program, procedure, or user-defined function if you pass values, variables, or arrays to the 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.