The .chain command passes control to a specified item-ID in the same (current) file or in a different (file reference) file.
NOTE |
Control does not return to the source item after executing the .chain command item. |
Syntax
.chain {dict} {file.reference} item-ID |
Parameter(s)
dict |
Specifies the dictionary where the file change resides. This parameter is optional. If not specified, the data section of the file is assumed. |
file.reference |
Specifies the file where the item change resides. This parameter is optional. If not specified, the item is read from the same file as the item being processed. |
item-ID |
Specifies the item to transfer control to. |
Description
This command proves particularly useful for generating form letters. It is possible to insert the name and address of each recipient of the letter from a separate file.
A sselect statement is used to extract the relevant data from the file and save it in a list. A series of readnext statements inserts the data into the text of the letter. At the end of the letter, a .chain command is used to restart the next letter. When the list is exhausted, the Output Processor stops.
Example(s)
The item letter is reprocessed until all stack data is exhausted.
u document letter Dear .readnext You may have won one million ($1,000,000) dollars.
Sincerely, John Doe .chain letter |
See Also
.read Command, .readnext Command, Output Processor Commands, Output Processor Overview, sselect Command