CL Command Reference - ELEM

CL Command List > ELEM Reference

Description:

The Element (ELEM) command definition statements are used to define the elements of a mixed list parameter on a command. A list parameter is a parameter that accepts multiple values that are passed together as consecutive values pointed to by a single parameter. The values are preceded by a 2-byte binary value that indicates the number of elements defined for the parameter.

A list item is the value that represents one value among a group of values organized in a specific order in a list. If all of the list elements are not of the same type, one ELEM statement must be used for each element that appears in the list being defined. If all the elements are of the same type (a simple list), individual ELEM statements are not required. For a simple list, all that is necessary is to specify the number of elements in the list on the Maximum values allowed (MAX) parameter of the PARM statement.

The order in which the ELEM statements are entered into the source file determines their positional order in the list. The first ELEM statement (for the first list item) must have a statement label that matches the statement label on the Type of value (TYPE) parameter of the PARM or ELEM statements for the same list. The remaining ELEM statements in the list must be unlabeled. Lists of elements having different values can be nested to the depth of three levels, including the highest level. A maximum of 300 elements can be included in one list.

Note: The ELEM statement contains certain parameters and predefined values that can be used only when an IBM-supplied command processing program (CPP) is called by the command being defined. Because there are limitations in some high-level languages, these values may not be useful in the definition statements of user-defined commands. If the entire parameter is for IBM-supplied commands only, these parameters and values are identified by the phrase (For IBM-supplied commands) that immediately follows the parameter keyword or the predefined value to which it applies.


Examples:

Example 1: Define a Parameter with Two Different Types of Elements

PARM KWD(JOBDESC) TYPE(L1) MIN(1)
L1: ELEM TYPE(*NAME) LEN(10) MIN(1)
ELEM TYPE(*DEC) LEN(2) MIN(1) REL(*LE 60)

The parameter named JOBDESC is required and has two elements which must both be specified. The first element is a ten-character name, and the second element is a 2-digit number that is less than or equal to 60.



Example 2: Define a Parameter with Similar Elements

PARM KWD(RANGE) TYPE(L1) MIN( DFT(*SAME) +
SNGVAL((*SAME 101))
L1: ELEM TYPE(*DEC) MIN(1) REL(*LE 100)
ELEM TYPE(*DEC) MIN(1) REL(*LE 100)

The parameter named RANGE can be omitted, but, if present, it must be a list of two numbers, neither of which can be greater than 100. To allow the command processing program to determine whether the value passed is a user-specified value or the *SAME single value, *SAME is mapped to 101 which is outside the normal range of values being checked for.