$CHAIN Statement
Allows two DataBasic source code modules to be compiled as a single program. Compilation of the first module ceases and the compiler continues with the module specified. Multiple modules can be combined into a single program by placing a $CHAIN statement at the end of each one except the last.
Note
$CHAIN cannot be used with old source compacted programs.
Syntax
$CHAIN item-name {FROM file-specifier}
$CHAIN file-specifier item-name
Syntax Elements
item-name The name of the item to be chained to the current source code module.
file-specifier The name of the file containing the item to be chained.
If file-specifier is omitted, item-name is retrieved from the file containing the item currently being processed.
Operation
$CHAIN should be used at the end of a source code module. Any statements following the $CHAIN statement are not compiled.
Any number of source code modules can be chained together.
When you compile a program containing a $CHAIN statement, an initial pass is made on the source item to merge in the chained item. Because the compiler processes only the resulting program, any line number references will be different from the attribute numbers in the actual item(s). To obtain the correct line numbers, use the 'L' option when compiling the program or use BLIST with the 'M' option.
See Also
Examples
$
CHAIN ITEMA
Chains to the item called ITEMA, found in the same file as the current program.
$
CHAIN ITEM1 FROM TESTFILE,SECT1
$
CHAIN TESTFILE,SECT1 ITEM1
Both the above examples chain to ITEM1, found in the data section SECT1 of file TESTFILE.