Using CHAIN to transfer to
another program
The CHAIN command was added as a special form of the RUN
command, except that CHAIN did not wipe out the contents of
variables when transferring from one program to another. Because
of this, many people who chained from program to program used
this style to create the one-form / one-program style of coding.
Although CHAIN is still useful for older programs, it is
not needed in version 2 and above programs since procedure
libraries can be held open in additional program buffers.
One of the issues with both CHAIN and RUN is that you sometimes
want to be able to start execution at a point OTHER then the
top of the program. For example, you might want to CHAIN to
a new program, but have it jump down to the data entry routine
for that form. In order to do this, you would normally have
to adopt some convention of passing some information from
the first program, to the second one, which would then be
intercepted at the top of the 2nd program, and then the 2nd
program can read this variable telling it where to go, and
then it can GOTO or jump into the middle of the code. Although
this works, it causes a lot of extra work on the part of the
programmer to maintain, and it's not needed in modern programs.
|