prev  Menu  next

PROGRAM, CHAIN

A PROGRAM statement declares a program name and parameters, which are used by CHAIN statements.
A CHAIN statement transfers the control to another program and terminates the program itself.

Restrincions on basicAcc and ParactBASIC.
Parameters of PROGRAM or CHAIN statements should be simple variables (Arrays not allowed).

PROGRAM statements

PROGRAM Program_Name
PROGRAM Program_Name(variable, variable,variable,・・・ ,variable)
The naming rule for Program_Name is same as that for numeric variables.
Example.
PROGRAM ABC(a,s$)

A PROGRAM statement must be written in the first line of a program.

For this program to be chained, it should be compiled.
BASICAcc or ParactBASIC makes an executable NoName.exe in the OUTPUT folder.
NoName.exe can be ranamed.

When a CHAIN statement has launched this program, the values that the CHAIN statement has handed over are substituted for the parameters.
A PROGRAM statement can be used for some program that is not necessarily written in BASIC to launch the program and hand over some parameters.

Exceptions
extype4301 Parameter mismatch
extype4302 Mismatched dimension of array parameter

CHAIN statements

CHAIN File_Name
CHAIN File_Name WITH ( expression,expression,…,expression )
File_Name is a string expression whose value shall be the name of an executable.
The values of expressions written in the WITH-clause shall be the parameters for the program.
Expressions are numerical expressions, or string expressions.
Example.
CHAIN "C:\Program Files (x86)\Decimal BASIC\BASICw32\basic.exe" with("/OR", "C:\Program Files (x86)\Decimal BASIC\BASICw32\FUNCTION\ABS.BAS")

Refer to command line parameters