Purpose, Operands, Streams, Usage, Examples, Related
(1) ┌─FROM─1─┐ >>──STEM──name.──┬────────┬──┼────────┼───────────────────────────────────────────>< └─BUFFer─┘ └─FROM─n─┘ (2) ┌─FROM─1─┐ >>──STEM──name.──────────────┼────────┼──┬────────┬──┬──────┬─────────────────────>< └─FROM─n─┘ └─APPend─┘ └─KEEP─┘ Notes: (1) When STEM is specified as the first stage of a pipeline. (2) When specified in any other position.
Use the STEM stage to (1) retrieve, or (2) set, an ooRexx compound variable whose name begins with
the stem you specify.
The stem name of an ooRexx
variable is that part of a variable name up to and including the last period, for example;
pipe.var. is the stem of the ooRexx variables
pipe.var.1, pipe.var.2, and pipe.var.3.
When STEM is the first stage of a pipeline, STEM retrieves variables. Before STEM can be
used to retrieve variables, variable name.0 must contain
the number of variables whose value you want to retrieve. The value should be 0 or a positive
integer.
For each variable retrieved, STEM writes a separate record containing the
variable's value to its primary output stream. By default, output records are written beginning
with name.1, followed by
name.2, name.3 and so on until the number of records
written equals the value of name.0.
Without specifying
additional stage command operands; the output records are written in ascending order of the numeric
suffix of the variables until the number of records written equals the size of the stem. When STEM
is not the first stage of a pipeline, STEM sets variables. By default, when STEM is used to set
variables, it sets one variable for each record in its primary input stream. Variables name.1 through name.n, where
n is the number of records in the primary input stream, are
set to the contents of the first through the nth input
stream record, respectively. After n records have been set,
STEM sets the variable name.0 to the number of variables
that were set.
**** Top of file **** Address Rxpipe banana.0 = 4 banana.1 = "Lady Finger" banana.2 = "Cavendish" banana.3 = "Williams" banana.4 = "Candy Apple" 'pipe stem banana. | sort | stem bunch.' Do n = 1 to bunch.0 Say bunch.n End Exit 0 **** End of file ****
output:
Candy Apple Cavendish Lady Finger Williams
**** Top of file **** Address Rxpipe line.0 = 4 line.1 = "I won't pass this line on" line.2 = "Or this one either" line.3 = "This is the first line that I want.." line.4 = "..followed by this one!" 'pipe stem line. from 3 | console' Exit 0 **** End of file ****
output:
This is the first line that I want.. ..followed by this one!
**** Top of file **** Address Rxpipe brand.0 = 3 brand.1 = "Gretsch" brand.2 = "Hofner" brand.3 = "Gibson" 'pipe literal /Fender Peavey/', '| split', '| stem brand. append' Do i = 1 to brand.0 Say brand.i End Exit 0 **** End of file ****
output:
Gretsch Hofner Gibson Fender Peavey