Stem variable Input and Output

Filter:

STEM

Syntax:

STEM stem_variable_name

Operands:

stem_variable_name :: any valid Rexx Index String name

Functional Description:

Use the STEM stage to retrieve or set NetRexx Indexed String compound variables whose names begin with the stem you specify. Specify STEM on a pipe invoked from a user-written JAVA or NetRexx program.

To use STEM you must provide an argument "STEM" followed immediately by an argument representing the stem variable, the NetRexx Indexed String. The Indexed String variable must be primed with the literal "STEM."

The stem of a variable is the Rexx Indexed String name. For example, LINE is the stem of the REXX variables LINE[1], LINE[2], ..., LINE[n]. The variable LINE should be preloaded with the string "STEM."

When STEM is the first stage of a pipeline, STEM retrieves values of variables. Before STEM can be used to retrieve variables, variable stem[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 stem1. 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 stem[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 stem[1] through stem[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 all n records have been set, STEM sets variable stem[0] to the number of variables that were set. STEM also copies its primary input stream records to its primary output stream.

Secondary Input/Output:

none

Usage Notes:

The following pipe will create a Rexx Indexed String containing 10 variables and reverse the characters in each string entry, then output the altered string entries to the console.

            LINE    = "STEM."
            OUTLINE = "STEM."
            loop ix = 1 to 10
               LINE[ix] = 'This is record '||ix
            end
            LINE[0] = 10
            apipe = pipe()
            apiarg = Rexx ''
            apiarg[0] = 5
            apiarg[1] = "STEM"
            apiarg[2] = LINE
            apiarg[3] = "reverse"
            apiarg[4] = "STEM"
            apiarg[5] = OUTLINE
            OUTLINE = apipe.apiprocess2(apiarg)
            say "OUTLINE is" OUTLINE 
            loop ix = 1 to OUTLINE[0]
                 say OUTLINE[ix] 
            end


JAVA Pipelines

Cullen Programming logo