18. Mixing )text and )action blocks

Example 18.1:

)text out='q1'





)action in='q1'

hideword = word.1

if word.1 < 6 then do

)action in='q1'

hideword "multiply by" word.1 "is "word.1 * hideword




Output is:

2 multiply by 2 is 4

2 multiply by 4 is 8

2 multiply by 6 is 12

4 multiply by 2 is 8

4 multiply by 4 is 16

4 multiply by 6 is 24

In this example it is necessary to move word.1 to the user defined variable hideword. This is done in the outer action block - to prevent overwriting of the variable when word.1 is assigned values in the inner action block during the run of the RXS program.


The principle of the 'execution counter' sweeping down the program, activating line after line, top to bottom, now becomes a bit complicated: When hitting an action block inside another action block, the outer action block is halted while the inner action block is interpreted consuming its own input. When finished, the outer action block turns active again.

If an action block tries to consume a RXS queue which is not yet produced, execution ends in error (more specific rules in section 12).



Assigning variables instead of values to general orders can be relevant:

Example 33.8:

)text out='q1'





)action in='q1'

)action out='myqualif.mydsn('word.1')'

"What's up doc?"



This RXS program will create (or replace) three members, A1, A2, and A3, in the dataset 'myqualif.mydsn'. All three members will contain a line with the text "What's up doc?"