Swapping Scenarios

Scenario 1

Replacement value is already known when the value to be replaced is encountered

In this case, the value to be swapped in is either a literal or a variable that has already been set.

For example, the location for the swap is at ‚ in the diagram below, and the value to be swapped in is set in a variable at . When the change has to be made, the replacement value is already known.

To do this:

    Put a SetVar rule (or another rule that puts a value into a variable) here.

‚    Put a Substitute rule on location for the swap.

Swapping Scenarios

Scenario 2

Replacement value is not known when the value to be replaced is encountered

In this case, the replacement value has not been set when the value to be replaced is reached:

For example, the value to be replaced is at  in the diagram below, but the value that replaces it is set at ‚

In this scenario, you will assign the find-replace pairs a “key” to link them together. This clears up ambiguities in case the file has repeating loops and therefore multiple find-replace pairs.

To do this: