Transfer control to the next step in a chain
This command is used in place of a $next_box command to transfer control to an infobox sequence (or 'chain') previously established by means of a $set_chain command. If no infobox chain has been set up, or if the end of the chain has been reached, control transfers to the end-of-chain location, which defaults to state IIF_PROC_COMPLETE (state 191), or state 128 (KILL_MAINT_OP) if the infobox sequence was started from a $worker_box FS file. This final destination can be overridden by an assignment to the system variable CHAIN_END.
This command allows a series of standalone infoboxes, or infobox sequences, to be defined, each standalone infobox or sequence ending with a $chain command. Then these sequences can be executed one after the other after as a 'chain'. See the $set_chain command description for information about setting up a chain.
The chain command is also used to initiate the processing of a newly-established chain and transfers control to the first item in the chain.
This command has no parameters.
Set up several pre-process infoboxes. Each box could be processed individually, without a chain having been established, and would at the end transfer to state 191 (IIF_PROC_COMPLETE):
.... processing for action A
.... processing for action B
.... processing for action C
.... processing for action D
Define a main pre-process infobox which processes actions A, C and D in turn:
The above preprocess will run the selected three actions in turn, and at the end transfer to state 191.
This command is an alternative to $next_box and is overridden if a $next_box is executed following it in the same infobox. As with $next_box, if you have a programming background, it is tempting to assume that $chain is equivalent to GOTO. It is not. In the following example, the chain will never be selected, because the current infobox is processed in its entirety before the next box is selected, and the second command will always override the first:
$if @response = 1 ; ! incorrect example
$chain ; ineffective
$next_box 9 ; always selected
The correct way to code the above example is:
$if @response = 1
Note that skipping the chain command in this way does not affect the established chain, which will be re-activated when a $chain command is eventually reached.