Using stems
When working with compound variables, it is often useful to
initialize
an entire collection of variables to the same value. You can do this
easily by using an assignment that includes a stem. For example,
number.=0
initializes
all array elements in the array named
number.
to
0.
You can change the values of all compound variables in an array
the same way. For example, to change all employee names to
Nobody
,
use the following assignment instruction:
employee. = 'Nobody'
As a result, all compound variables beginning with the stem
employee.,
previously assigned or not, have the value Nobody. After a stem assignment, you can
assign individual compound variables new values.
employee.='Nobody'
SAY employee.5 /* Produces 'Nobody' */
SAY employee.10 /* Produces 'Nobody' */
SAY employee.oldest /* Produces 'Nobody' */
employee.new = 'Clark, Evans'
SAY employee.new /* Produces 'Clark, Evans' */
You can use stems with the EXECIO and RFS commands when reading to and writing from a file. See EXECIO and RFS. RFS is the preferred I/O method under CICS.