Welcome to jBASE's new documentation site! Many answers to your questions can be found by searching the Knowledgebase or viewing the jBASE Documentation. We also have a Google Group for peer discussion about jBASE. If you are unable to find the information you are looking for, jBASE Support will be glad to assist in resolving your technical problems. Enjoy and please provide comments and feedback .

How can we help you?

CHAIN

Description

The CHAIN statement exits the current program and transfers process control to the program defined by the expression. Process control will never return to the originating program. The statement takes the form:

CHAIN expression

Where expression should evaluate to a valid UNIX or Windows command, Which may be another jBASE BASIC program.

The command string may be suffixed with the ‘I’ option, which will cause any COMMON variables in the current program to be inherited by the new program (providing it is a jBASE BASIC program).

Note:

There are no restrictions to the CHAIN statement. However, it is advisable that your program follows a logical path easily seen by another programmer.

If the program, which contains the CHAIN command (the current program) was called from a JCL program, and the program to be executed (the target program) is another jBASE BASIC program, control will return to the original JCL program when the target program terminates. If the target program is a JCL program, control will return to the command shell when the JCL program terminates.

Examples: 

CHAIN "OFF" ;* exit via the OFF command

Consider two programs as: 

001    PROGRAM Prog1
002    COMMON A,B
003    A = 50;
004    B = 100
005    CHAIN "NEWPROG (I"
001    PROGRAM NEWPROG
002    COMMON I,J
003    * I and J inherited
004    CRT I,J

running prog1 will result in: 

50      100

being displayed. 

Go back to jBASE BASIC.


Was this article helpful?