.chain command (Runoff)

The .chain command transfers control to the specified item-ID.


.chain {file.reference} item-ID


file.reference Specifies the file where the item change resides. If not specified, the current file is used. Control does not return to the source item.
item-ID Specifies the item to transfer control to.


.chain next.doc

The item next.doc is processed at the end of the document that called it.


This command is particularly useful for generating form letters. For example, it may be necessary 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 may be used to restart the next letter. When the list is exhausted, Runoff stops.