STEM stage v1.0

Pipelines v2.0

 

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

Home

 

Syntax

 
                 _NOBUFFER_    _from 1__
>>__STEM__name__|__________|__|_________|______________________________________________><
                |_BUFFER___|  |_APPEND__|
                              |_from_n__|
 

Notes:

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

primary input stream connected.

(2)    APPEND cannot be specified on a STEM stage that is used as the first stage of a

    pipeline.

 

Purpose

 

Use the STEM stage to retrieve or set an ooRexx compound variable whose name begin 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 values of 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 positive. 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. The output records are written in ascending order of the numeric suffix of the variables until the number of records written equals the value of name.0.

 

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 records, respectively. After n records have been set, STEM sets the variable name.0 to the number of variables that were set. STEM also copies its primary input stream records to its primary output stream.

 

Operands

 

    

name

is the name of the compound variables whose values you want to set or retrieve. The name of an ooRexx variable is that part of a variable name up to and including the last period.

 

    

NOBUFFER

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

 

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

 

    

BUFFER

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

 

BUFFER can only be specified on a STEM 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 value of variable name.0. Variable name.0 must contain a zero or positive whole number prior to invoking the STEM stage with the APPEND operand. After all variables have been set, STEM sets variable name.0 to the numeric suffix of the last variable that was set.

 

APPEND cannot be specified on a STEM 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 or equal to the value in name.0. After all variables have been set, when STEM is not the first stage in the pipeline, STEM sets variable name.0 to the numeric suffix of the last variable that was set. The default value for n is 1.

 

Streams used

 

The following streams are used by the STEM stage:

 

Stream

Action

 

 

Primary input stream

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

Primary output stream

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

 

Usage notes

 

     1)

STEM does not delay the records.

 

     2)

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

 

     3)

STEM 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:

 

ARRAY, VARIABLE

 

History of change

 

None.