| Navigation: Language Reference > 13 - Built-in Functions >====== CHAIN (execute another program) ====== | ![]() ![]() |
CHAIN(program)
| CHAIN | Terminates the current program and executes another. |
| program | A string constant or variable containing the name of the program and optional command line parameters to execute. This may be any .EXE or .COM program. |
CHAIN terminates the current program, closing all files and returning its memory to the operating system, and executes another program.
Example:
** PROGRAM !MainMenu program code**
** CODE**
** EXECUTE CHOICE()**
** **CHAIN('Ledger') !Execute LEDGER.EXE
** **CHAIN('Payroll **/Test=1 /N=2**') !Execute PAYROLL.EXE with parameters
** RETURN !Return to O/S**
** END**
** PROGRAM !Ledger program code**
** CODE**
** EXECUTE CHOICE()**
** **CHAIN('MainMenu') !Return to MainMenu program
** RETURN !Return to O/S**
** END**
** PROGRAM !Payroll program code**
** CODE**
** EXECUTE CHOICE()**
** **CHAIN('MainMenu') !Return to MainMenu program
** RETURN !Return to O/S**
** END**
See Also:




