Defining lists within lists for a CL command parameter

A list within a list can be either a list that can be specified more than once for a CL command parameter (simple or mixed list), or a list that can be specified for a value within a mixed list.

The following is an example of lists within a list.


STMT((START RESPND) (ADDDSP CONFRM))

The outside set of parentheses enclose the list that can be specified for the parameter (the outer list) while each set of inner parentheses encloses a list within a list (an inner list).

In the following example, a mixed list is defined within a simple list. A mixed list is specified, and the MAX value on the PARM statement is greater than 1; therefore, the mixed list can be specified up to the number of times specified on the MAX parameter.


        PARM KWD(PARM1) TYPE(LIST1) MAX(5)
LIST1:  ELEM TYPE(*CHAR) LEN(10)
        ELEM TYPE(*DEC) LEN(3 0)

In this example, the two elements can be specified up to five times. When a value is entered for this parameter, it could appear as follows:


PARM1((VAL1 1.0) (VAR2 2.0) (VAR3 3.0))

In the following example, a simple list is specified as a value in a mixed list. In this example, the MAX value on the ELEM statement is greater than 1; therefore, the element can be repeated up to the number of times specified on the MAX parameter.


        PARM KWD(PARM2) TYPE(LIST2)
LIST2:  ELEM TYPE(*CHAR) LEN(10) MAX(5)
        ELEM TYPE(*DEC) LEN(3 0)

In this example, the first element can be specified up to five times, but the second element can be specified only once. When a value is entered for this parameter, it could appear as follows.


PARM2((NAME1 NAME2 NAME3) 123.0)

When lists within lists are passed to the command processing program, the format varies depending on whether you are using CL (or another high-level language) or REXX.