| Directives |
|
| Format | ENTER
[ arglist ][, ...]][,ERR=stmtref]
|
|||||||||||||||
| Description | Use
ENTER in a called subprogram to define
fine the total number, relative positions and types of
variables it will receive from the calling program. The arguments passed to the subprogram via the calling program's CALL statement. The variables in the calling program's CALL statement must ordinarily match those in the subprogram exactly. That is, each argument in the CALL statement must correspond by position and in type (numeric or string) to a variable in the ENTER statement. Otherwise, ProvideX returns Error #36: ENTER parameters don't match those of the CALL. If the calling program is passing a complete numeric array, the name of the array must be specified, followed by {ALL} in both the ENTER and CALL statements. (the curly brackets are part of the syntax). Where a CALL statement specifies a simple variable, all changes made to the variable ENTERed in your subprogram will be reflected in the calling program when the subprogram terminates. You can protect a simple variable in either the CALL or ENTER statement by placing the argument inside parentheses his turns the variable into an expression, which has the effect of making it read only. String templates cannot be passed if they are defined prior to the ENTER statement in the called program. |
|||||||||||||||
| Default Values | If
desired, variables on the ENTER statement can have
default values specified as in the following:
When a variable is followed by an equal sign and the calling program does not provide a value in its calling sequence, the value of the expression following the equal sign is used to establish a starting/default value for the variable. In the above example, if this program was called with only one parameter, the second variable (DB$) would be set to value found in %Current_DB$. This means that a caller could simply code:
The use of default values allows application designers and programmers to reduce the complexity of CALL parameters for many common functions.
|
|||||||||||||||
| See Also | CALL Transfer to Subprogram. | |||||||||||||||
| Examples | In
calling program:
In subprogram "SUBR":
|
|||||||||||||||