Product Site

5.3.16. Stem Class

A Stem object is a MapCollection with unique indexes that are character strings.
Table 5.26. Stem Class

Stems are automatically created whenever a Rexx stem variable or Rexx compound variable is used. For example:
Example 5.206. Stem class — examples
a.1 = 2

creates a new stem collection with the name A. and assigns it to the Rexx variable A.; it also assigns the value 2 to entry 1 in the collection.

The value of an uninitialized stem index is the stem object NAME concatenated with the derived stem index.
Example 5.207. Stem class — examples
say a.[1,2]  -- implicitly creates stem object with name "A."
-- displays "A.1.2"

a = .stem~new("B.")
say a[1,2]     -- displays "B.1.2"

In addition to the items explicitly assigned to the collection indexes, a value may be assigned to all possible stem indexes. The []= method (with no index argument) will assign the target value to all possible stem indexes. Following assignment, a reference to any index will return the new value until another value is assigned or the index is dropped.

The [] method (with no index specified) will retrieve any globally assigned value. By default, this returns the stem NAME value.

In addition to the methods defined in the following, the Stem class removes the methods =, ==, \=, \==, <>, and >< using the DEFINE method.