Transfers control one-way from one cataloged program to another cataloged program.
ENTER ctlg-name
ENTER @ctlg-var
ctlg-name is the name of a cataloged program.
ctlg-var is a variable evaluating to the name of a cataloged program.
ENTER transfers control to a DataBasic program that has already been compiled and cataloged. The program executing the ENTER statement must also be cataloged.
All variables to be passed between programs must be declared in COMMON statements in the program transferring control and in the program being entered. All other variables are initialized when the program is entered.
You can ENTER a program that calls a subroutine, but you cannot ENTER a program from a subroutine or invoke a subroutine with the ENTER statement.
ENTER works faster than the CHAIN statement. However, if the programs are not cataloged, you must use CHAIN RUN, together with option 'I' if COMMON variables are to passed.
ENTER PGM1
Executes cataloged program PGM1. Any COMMON variables are passed to PGM1.
I=2 PROGRAM="PGM":I ENTER @PROGRAM
Executes PGM2 and passes any COMMON variables to PGM2.