Skip to main content
Previous section   Next section

ENTER

Transfers control to an external subroutine.

Synopsis

ENTER name

Arguments

name Name of the external subroutine to call.

Description

The ENTER statement can be used to call an external subroutine. The external subroutine must have been compiled and cataloged. No parameters can be passed using ENTER; use CALL if you need to pass parameters to a subroutine. When ENTER is used to call an external subroutine, the RETURN statement within the external subroutine does not return control to calling program; use CALL if you need to return following a subroutine call.

ENTER calls the external subroutine without increasing the stack level. This can be useful when issuing a large number of calls without returning. Because ENTER is not increasing the stack level, a <FRAMESTACK> error cannot occur.

You can use name to specify the external subroutine either directly or indirectly:

  • The name argument can specify the exact name under which the subroutine was cataloged.

  • The name argument can specify the name of a variable that contains the name of the subroutine. A variable of this type is prefaced with the @ symbol. A variable name can be a local variable, or an element of an array.

You can also use the COMMON statement to make specified variables available to all external subroutines.

ENTER, CALL, GOSUB, and SUBR

The ENTER statement is used to call an external subroutine with no parameter passing or return, and without increasing the stack level. The CALL statement is used to call an external subroutine with parameter passing and returning. CALL increases the stack level.

The GOSUB statement is used to call an internal subroutine. The SUBR function is used to call an external subroutine that returns a value.

Examples

The following example uses ENTER to call an external subroutine:

Main
  x="Burma"
  PRINT x           ! Returns "Burma"
  ENTER ErrorSub
  PRINT x           ! Does not execute

ErrorSub
  PRINT "An error occurred"
  QUIT
Copy code to clipboard

See Also