op.chain Command/Output Processor: Commands


Command op.chain Command/Output Processor: Commands
Applicable release versions: AP
Category Output Processor: Commands (183)
Description passes control to a specified item-id in the same (current) file or in a different (file.reference) file.

If "file.reference" is not specified, the current "file.reference" is used.

The {dict} and {file.reference} are both optional.

If "dict" is not specified, the "data" section of the file is assummed. If no "file.reference" is given, the item is read from the same file as the item being processed.

Control does not return to the source item after executing the 'chained' item.
Syntax .chain {dict} {file.reference} item-id
:u document letter 
Dear  .readnext 

You may have won one million ($1,000,000) dollars.

John Doe
.chain letter

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, OP will stop.
Related access.sselect