ARRAY stage v1.0

Pipelines v2.0

 

Purpose, Operands, Streams used, Usage notes, Examples, See also

Home

 

Syntax

 
                  _NOBUFFER_    _from 1__
>>__ARRAY__name__|__________|__|_________|_____________________________________________><
                 |_BUFFER___|  |_APPEND__|
                               |_from_n__|
 

Notes:

(1)  NOBUFFER and BUFFER can only be specified on an ARRAY stage that does not have a

primary input stream connected.

(2)  APPEND cannot be specified on an ARRAY stage that is used in the first stage of a

    pipeline.

 

Purpose

 

Use the ARRAY stage to retrieve or set ooRexx array variables whose name begin with the array name that you specify.

 

When ARRAY is the first stage of a pipeline, ARRAY retrieves values of variables. 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. 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 records, respectively. ARRAY also copies its primary input stream records to its primary output stream.

 

Operands

 

    

name

is the name of the array whose values you want to set or retrieve.

 

    

NOBUFFER

specifies that ARRAY will make repeated calls into the ooRexx API mechanism to access array elements . This is the default.

 

NOBUFFER can only be specified on an ARRAY stage that does not have a primary input stream connected.

 

    

BUFFER

specifies that ARRAY will read the entire array into a buffer before writing any records to its primary output stream. This option, for small to medium sized arrays, provides the fastest and most efficient option. Repeated calls into the ooRexx API to request access to variable data is costly and somewhat slow, however, a single call where the entire array is pre-loaded during the ARRAY initialisation phase can greatly improve performance.

 

BUFFER can only be specified on an ARRAY stage that does not have a primary input stream connected.

 

    

APPEND

specifies that variables are to be set beginning with name[n+1] where n is the current size of the array.

 

APPEND cannot be specified on an ARRAY stage that is used in the first stage of a pipeline.

 

    

FROM n

specifies that the values of variables are to be retrieved or variables are to be set beginning with name[n]; where n is the value specified. When retrieving a variable, n should be 0 or positive, and less than the size of the array. The default value for n is 1.

 

Streams used

 

The following streams are used by the ARRAY stage:

 

Stream

Action

 

 

Primary input stream

ARRAY reads records its primary input stream, if it is connected and writes them the specified ooRexx array.

Primary output stream

ARRAY writes records to its primary output stream, if it is connected.

 

Usage notes

 

     1)

ARRAY does not delay the records.

 

     2)

If the ARRAY stage discovers that both its primary input and primary output streams are not connected, the ARRAY stage ends.

 

     3)

ARRAY verifies that it has either a primary input stream and/or a primary output stream connected and then begins execution.

 

Examples

 

None.

 

See also

 

Reference the following links for additional information:

 

STEM, VARIABLE