Directives
ENTER Specify Arguments
   
Format ENTER [ arglist ][, ...]][,ERR=stmtref]

Where:

arglist. Variables in a subprogram to receive the arguments passed by a calling program. Use:
  • IOL=ioltref (e.g., ENTER IOL=8000),
  • a complete numeric array (e.g., ENTER ARRAY_NAME{ALL}), or
  • a comma-separated list of simple numeric and/or string variables
    (subscripts or substrings are not allowed)

Each simple variable (numeric or sring) may be followed by an equal sign and an expression which will be used to define its default value. (See Default Values below)

stmtref Program line number or statement label to which to transfer control.
   
  Restrictions: You can only use this directive in called programs (subprograms). You cannot receive the same argument more than oncefrom the calling program.
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:

ENTER Cust$, DB$ = %Current_DB$

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:

CALL "Program", CUST$ ! To access customers in current Database

CALL "Program", CUST$, COMPANY_DEF$ ! To override the Database

The use of default values allows application designers and programmers to reduce the complexity of CALL parameters for many common functions.

The specification of defaults is a +PxPlus Exclusive

   
See Also CALL Transfer to Subprogram.
   
Examples In calling program:

0170 CALL "SUBR",LEN(A$),N,A$,T{ALL}

In subprogram "SUBR":

0020 ENTER A,B,Z$,N{ALL}