Purpose, Argument, Streams, Usage, Examples, Related
(1) ┌─FROM─1─┐ >>──ARRAY──name──┬────────┬──┼────────┼──────────────────────────────────────────────>< └─BUFfer─┘ └─FROM─n─┘ (2) ┌─FROM─1─┐ >>──ARRAY──name──────────────┼────────┼──┬────────┬──┬──────┬────────────────────────>< └─FROM─n─┘ └─APPend─┘ └─KEEP─┘ Notes: (1) When ARRAY is specified as the first stage of a pipeline. (2) When specified in any other position.
Use the ARRAY stage to (1) retrieve, or (2) set, an ooRexx compound variable whose name begins with the array you specify.
For each variable
retrieved, ARRAY 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~items.
Without specifying
additional stage command arguments; 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
array. When ARRAY is not the first stage of a pipeline, ARRAY sets variables. By default, when
ARRAY 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.
**** Top of file **** Address Rxpipe
banana = .array~of( "Lady Finger", "Cavendish", "Williams", "Candy Apple" ) 'pipe array banana | sort | array bunch'
do n = 1 to bunch~items Say bunch[n] End
Exit 0 **** End of file ****
output:
Candy Apple Cavendish LadyFinger Williams
**** Top of file **** Address Rxpipe
line = .array~new(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 array 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 = .array~new() brand~put('Gretsch', 1) brand~put('Hofner', 2) brand~put('Gibson', 3)
'pipe literal /Fender Peavey/', '| split', '| array brand append'
Do i = 1 to brand~items Say brand[i] End
Exit 0 **** End of file ****
output:
Gretsch Hofner Gibson Fender Peavey