5. General orders for action blocks

Putting the coding of RXS into action blocks offers the opportunity to specify what the coding is to work against: what is input, how to fundamentally interpret input, where to put output, and what to happen when the putting of output is finished. These kinds of specifications are called 'general orders'. A 'general order' is an assignment placed in the line starting with the word )action.

Some common general orders are:

in                                       what is input?

func                           how to interpret input?

outfile or out               where to write output?

outfunc                          how to treat output when terminating the RXS program.

General orders are in REXX syntax, that is assignments in the form outfunc='edit'. If the action block has more than one general order, the orders are written one per line, using the contination marker for blocks which is )&. For instance:

)action out='mylib.mydsn(mymbr)'

)&      outfunc='browse'

Alternative: separate the general orders by one ';' and write more than one general order in the same line. For instance:

)action out='mylib.mydsn(mymbr)';outfunc='browse'

If one general order is longer than what fits on the edit-screen, it may be split over more than one line, using the continuation marker '||' on the continuated line. For instance:

)action out='C:\ACME Cooporation\Management\Administration'

)& ||   '\Sales department\employees'

)& ||   '\empolyee of the month\october 2013.txt'

)&      outfunc='browse'

Lines continuated using the concatenation marker '||' on the continuated line will be concatenated without any interleaving blank.

General orders may be any executable statement in REXX syntax. Coding placed as general orders will execute when the action block 'starts up', that is, when the execution of the RXS program hits the top of the action block.

Again: imagine some 'execution counter' sweeping down the program, line after line. When this execution counter hits an action block, the general orders in the )action line is interpreted first and once, the rest of the action block is then read in and is interpreted repeatedly for each element in input for the action block. If the action block doesn't use input, the action block is interpreted once.

General orders are - when introduced first time - in the following sections written in typeset courier bold.


5a. General orders can be any coding

Anything may be programmed as general orders in the )action line. You may write

if a=4 then out='q1' else out='q2'

or

say 'ok - so far, no problems'

or whatever.

Exception: RXS block constructs cannot be used as general orders: you cannot inside a general order use )action and )imbed etc.