Parameters Examples Error messages |
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.
Top |
Keyword | Description | Choices | Notes |
---|---|---|---|
TYPE | Type of value | Simple name, *DEC, *CHAR, *LGL, *NAME, *VARNAME, *INT2, *GENERIC, *INT4, *DATE, *TIME, *ZEROELEM, *HEX, *SNAME, *PNAME, *UINT2, *UINT4, *X, *CNAME | Required, Positional 1 |
LEN | Value length | Values (up to 3 repetitions): Integer | Optional, Positional 2 |
CONSTANT | Constant value | Character value | Optional |
RSTD | Restricted values | *YES, *NO | Optional |
DFT | Default value | Character value | Optional |
VALUES | Valid values | Values (up to 300 repetitions): Character value | Optional |
REL | Relational expression | Element list | Optional |
Element 1: Relational operator | *GT, *EQ, *GE, *NL, *LT, *NE, *LE, *NG | ||
Element 2: Value | Character value | ||
RANGE | Range of values | Element list | Optional |
Element 1: Lower value | Character value | ||
Element 2: Upper value | Character value | ||
SPCVAL | Special values | Values (up to 300 repetitions): Element list | Optional |
Element 1: From value | Character value | ||
Element 2: To replacement value | Character value | ||
SNGVAL | Single values | Values (up to 300 repetitions): Element list | Optional |
Element 1: From value | Character value | ||
Element 2: To replacement value | Character value | ||
MIN | Minimum values required | 0-300, 0 | Optional |
MAX | Maximum values allowed | Integer, 1 | Optional |
ALWUNPRT | Allow unprintable characters | *YES, *NO | Optional |
ALWVAR | Allow variable names | *YES, *NO | Optional |
PGM | Is ELEM a program | *NO, *YES | Optional |
DTAARA | Is ELEM a data area | *NO, *YES | Optional |
FILE | If a file parameter, how used | *NO, *IN, *OUT, *UPD, *INOUT, *UNSPFD | Optional |
FULL | Full field required | *YES, *NO | Optional |
EXPR | Value an expression | *NO, *YES | Optional |
VARY | Varying length | Single values: *NO Other values: Element list |
Optional |
Element 1: Return length value | *YES | ||
Element 2: Value length | *INT2, *INT4 | ||
PASSATR | Pass attribute byte | *YES, *NO | Optional |
CASE | Case of value | *MONO, *MIXED | Optional |
CCSID | CCSID of value | *JOB, *UTF16 | Optional |
DSPINPUT | Display input | *YES, *PROMPT, *NO | Optional |
CHOICE | Choice text | Character value, *VALUES, *NONE, *PGM | Optional |
CHOICEPGM | Choice program | Single values: *NONE Other values: Qualified object name |
Optional |
Qualifier 1: Choice program | Name | ||
Qualifier 2: Library | Name, *LIBL, *CURLIB | ||
INLPMTLEN | Initial prompt length | *CALC, *PWD, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 17, 25, 32, 50, 80, 132, 256, 512 | Optional |
PROMPT | Prompt text or message ID | Character value, *NONE | Optional |
Top |
Specifies the type of list item being defined. The element can be an integer, a decimal or logical value, or a quoted or not quoted character string that can be a name, label, date, or time.
Top |
Specifies the length of the list item value that is passed to the command processing program (CPP).
If *INT2, *INT4, *UINT2, *UINT4, *DATE, *TIME, *ZEROELEM, or statement label is specified on the Type of value (TYPE) parameter, this parameter is not allowed.
If *DEC is specified on the Type of value (TYPE) parameter, the decimal length is specified in the form (n1 n2), where n1 specifies the total number of digits in the value (including the decimal portion), and n2 specifies the number of allowable decimal digits to the right of the decimal point. (The value for n2 is optional. Zero is assumed if n2 is not entered.)
If *X is specified for the Type of value (TYPE) parameter, the LEN parameter is used as follows:
If TYPE is other than *DEC or *X, the second and third list elements must be omitted and simply the number of characters must be specified.
Top |
Specifies that a value is passed to the CPP as a constant for the list item when the command being defined is processed; the element is not to appear externally on the command. If specified, the value must satisfy the requirements specified by the following parameters:
If a character constant is specified in this parameter, it can be no longer than 32 characters. This parameter is not valid in the following cases:
If a constant is specified for the element being defined, no prompt text can be specified for the Prompt text or message ID (PROMPT) parameter. However, the other elements of the list parameter (of which this list item is a part) are still prompted, and their values along with this constant value are still passed to the CPP as a list.
Variables cannot be coded for this parameter.
Top |
Specifies whether the value entered for the list item (specified in the ELEM statement) is restricted to only one of the values given in the Valid values (VALUES) parameter, the Special values (SPCVAL) parameter, or the Single values (SNGVAL) parameter; or if the value can be any value that satisfies the requirements specified by the following parameters:
Top |
Specifies the default value that is assigned to the list item if the user does not specify a value. That is, the default value is used as the value of the list item if the user omits the parameter that represents this list item, or specifies *N for the element, while coding or entering the command. The default value must satisfy one of the following:
This parameter is valid only if the Minimum values required (MIN) parameter is 0, which means the element defined by this ELEM statement for this list is optional. This parameter is not allowed if the Constant value (CONSTANT) parameter is specified. A default cannot be specified if *ZEROELEM is specified for the Type of value (TYPE) parameter; in that case, an assumed default is passed.
An assumed default value is not displayed by the command prompt; a blank input field is shown instead. If a default is specified in this parameter, it is displayed by the prompt exactly as specified.
Variables cannot be coded for this value.
Top |
Specifies a list of up to 300 constants (fixed values) from which one constant can be specified as the value of the list item. This parameter is valid only if all of the following are true:
Character constants specified in this parameter can be no longer than 32 characters. Specify up to 300 constants that can be specified as the value of the list item. This parameter is not valid if a statement label or *ZEROELEM is specified for the Type of value (TYPE) parameter;
If this ELEM statement is defining the first element in a list, the value specified for this parameter cannot be the same as the value specified in the Single values (SNGVAL) parameter on either the PARM or ELEM statement that points to this ELEM statement.
Top |
Specifies the relationship between the list item value and the value of another parameter or constant. The value associated with the referred to keyword is the value passed to the CPP, not the user-specified value. To specify the relationship, enter one of the following relational operators followed by a constant or the value of another parameter.
This parameter is not valid if *LGL, *VARNAME, *ZEROELEM, or a statement label is specified for the Type of value (TYPE) parameter, or if either the Range of values (RANGE) parameter or the Valid values (VALUES) parameter is specified. If *CHAR (character type) is specified by the Type of value (TYPE) parameter, the EBCDIC value of the character string is used as an unsigned integer in the comparison. If a character constant is specified in this parameter, it can be no longer than 32 characters.
Top |
Specifies the range, or the limits, for the value of the list item. The list item value must be greater than or equal to the lower limit value specified, and it must be less than or equal to the upper limit value specified. The value tested is the value sent to the CPP, not the user-specified value.
For nonnumeric data types, such as *CHAR, the range of values and the data specified will be right-justified and padded on the left with blanks. A numeric range should not be used to define an interval for nonnumeric data unless leading zeros are specified or the data is only 1 character in length.
This parameter is not valid if either the Relational expression (REL) parameter or the Valid values (VALUES) parameter is specified, or if *LGL, *VARNAME, *ZEROELEM, or statement label is specified on the Type of value (TYPE) parameter. Character constants specified in this parameter can be no longer than 32 characters.
Top |
Specifies a list of up to 300 entries that define special values that can be entered for the element defined by this ELEM statement. Each entry specifies a character string (from value) that can be entered even though it may not meet all validity checking requirements. If the entered character string matches the from-value of one of the entries, and the to-value is specified, the string is replaced with the to-value and is then passed to the command processing program (CPP) without further checking. If the to-value is omitted, the from-value is passed to the CPP. This parameter is not valid if a statement label or *ZEROELEM is specified for the Type of value (TYPE) parameter.
If a to-value of *CURLIB is specified, the name of the current library is passed to the CPP rather than the value *CURLIB. If the from-value is *CURLIB and no to-value is specified, or if the to-value is *CURLIB and it is enclosed in apostrophes, the value *CURLIB is passed to the CPP.
The from-value is a character string, but the to-value can be anything that is passable. However, if *DATE is specified for the Type of value (TYPE) parameter, the to-value must be specified not quoted in one of the following formats: mmddyy, mmddyyyy, or cyymmdd.. If a CL variable is used for the from-value, its type must be *CHAR. If this ELEM statement is defining the first element in a list, the value specified for the from-value cannot be the same as the value specified in the Single values (SNGVAL) parameter on either the PARM or ELEM statement that points to this ELEM statement.
The to-value must be no longer than is specified on the Value length (LEN) parameter; and, if *DEC, *INT2, *INT4, *UINT2 or *UINT4 is specified for the Type of value (TYPE) parameter, the type of the to-value must be the same. If a character type (such as *CHAR, *LGL, or *DATE) is specified for the Type of value (TYPE) parameter, the to-value must be a character string. Character constants specified in this parameter can be no longer than 32 characters. If a to-value is not specified, the from-value must be passable.
Variables cannot be coded for this element.
Top |
Specifies a list of up to 300 single values that can be specified for an element being defined as a statement label, or that is to have two or more list items in its nested list (defined by the Maximum values allowed (MAX) parameter). Any one of the single values can be used instead of a nested list of values or a qualified name that the element is defined to accept. Each entry specifies a character string (from-value) that can be entered. If an entered character string matches the from-value of one of the entries and the to-value is specified, the data is replaced with the to-value and is then passed to the command processing program (CPP) without further checking. If the to-value is omitted, the from-value is passed to the CPP. If this ELEM statement is defining the first element in a list, the value specified for the from-value cannot be the same as the value specified in the Single values (SNGVAL) parameter on either the PARM or ELEM statement that points to this ELEM statement.
The to-value (or the from-value, if the to-value is omitted) must be passable, as specified in the Special values (SPCVAL) parameter. Character constants specified in this parameter can be no longer than 32 characters. This parameter can be specified only if the Maximum values allowed (MAX) parameter is greater than one or if a statement label is specified for the Type of value (TYPE) parameter. It is not valid if *ZEROELEM is specified for the Type of value (TYPE) parameter. Each single value can only substitute for a list of values or a qualified name; it cannot be a list item or qualifier. It is passed as the first element of the list.
If a to-value of *CURLIB is specified, the name of the current library is passed to the CPP rather than the value *CURLIB. If the from-value is *CURLIB and no to-value is specified, or if the to-value is *CURLIB and it is enclosed in apostrophes, the value *CURLIB is passed to the CPP.
Variables cannot be coded for this element.
Top |
Specifies the minimum number of values that must be entered for the element being defined. For an element that does not allow multiple like values, only zero (0) for optional and one (1) for required can be specified as the minimum number of values.
For an element that allows multiple like values (because a value greater than one is specified in the Maximum values allowed (MAX) parameter), zero (0) indicates that no values must be entered; therefore, it is an optional element. A value of one (1) or greater than one indicates the minimum number of values that must be entered for the element, and therefore it is a required element. The value specified for this parameter cannot exceed the value specified for the Maximum values allowed (MAX) parameter. The number specified tells how many list items are required in another list. If this parameter is not specified, zero (0) is assumed, which means that the element is optional.
Top |
Specifies, if this ELEM statement is defining a simple list item, the maximum number of elements that this list item can have in its nested list. If a value greater than 1 is specified, the element is capable of accepting multiple like values (that is, a simple nested list). All values entered for this element (at the time the command is run) must satisfy the validity checking requirements specified by the other parameter values on this ELEM statement.
Note: The values for a nested list are passed consecutively, preceded by a 2-byte binary value that indicates the number of values entered in the list item by the user. CL programs do not support the handling of binary values in variables.
Top |
Specifies whether this ELEM statement should accept the hexadecimal characters above X'FF' and those in the range of X'00' to X'3F'. This parameter is valid only if *CHAR or *X is specified for the Type of value (TYPE) parameter.
Top |
Specifies whether variable names are allowed for the element. *NO is not allowed if *VARNAME, *ZEROELEM, *NULL, or a statement label is specified for the Type of value (TYPE) parameter.
Top |
Specifies whether this element is a program name. *YES is valid only if a statement label, *CHAR, *NAME, *SNAME, *CNAME, or *GENERIC is specified for the Type of value (TYPE) parameter. The specification of *YES on this parameter does not have any effect on the element being defined by the ELEM statement; it only indicates to the compiler that the value for this element is a program name. This information is stored so that it can be included in the output of the Display Program References (DSPPGMREF) command.
Top |
Specifies whether the element is a data area name. *YES is valid only if a statement label, *CHAR, *NAME, *SNAME, *CNAME, or *GENERIC is specified for the Type of value (TYPE) parameter. The specification of *YES on this parameter does not have any effect on the element being defined by the ELEM statement; it only indicates to the compiler that the value for this element is a data area. This information is stored so that it can be included in the output of the Display Program References (DSPPGMREF) command.
Top |
Specifies whether if the list item is a file name and the expected use of the file. The element can be specified as the name of a file that has a specific use so that, at compile time, the names can be used to get file reference information about where the files are used. This parameter is valid only if a statement label, *CHAR, *NAME, *SNAME, *CNAME, or *GENERIC value is specified for the Type of value (TYPE) parameter. The specification in this parameter does not have any effect on the list item being defined by the ELEM statement; it only indicates to the compiler that the value for this element is a file name and what type of file it is. This information is stored so that it can be included in the output of the DSPPGMREF (Display Program References) command. One of the following types of files can be specified:
Top |
Specifies whether the number of characters in the list item must be exactly the same as the number specified in the Value length (LEN) parameter (if specified) or its default length (if LEN is not specified).
Top |
Specifies whether the element can accept an expression containing a character concatenation.
Top |
Specifies whether the list item value that is passed to the CPP is preceded by a length value that indicates the number of characters entered for the element's value.
Single values
Element 1: Return length value
Note: The length value is the actual number of characters entered for the command parameter with trailing blanks removed. The length value passed may be different than the defined parameter length or the declared variable length. The length of the field containing the character string data is determined by the defined length for the parameter or the declared LEN for CL Program variables. The length value defines how many characters in the character string data field were actually entered for the command parameter.
Element 2: Value length
Top |
Specifies whether an attribute byte is to be passed to the command processing program (CPP) with the list item data. This parameter is not valid if a statement label or *ZEROELEM is specified for the Type of value (TYPE) parameter.
The attribute byte precedes the list item data. If the list item allows multiple values to be specified, an attribute byte precedes each value.
The attribute byte has two fields:
Attribute Description ---------- -------------------------------------- '0000010'B Meets *NAME rules, like A_B '0000100'B Meets *GENERIC rules, like AB* '1000101'B Quoted character string, like 'A B' '0000101'B Unquoted character string, like 5A '1001000'B Logical constant, '0' or '1' '0001100'B Hexadecimal value, like X'C1C2' '0100001'B Unsigned numeric value, like 5 '0101001'B Unsigned numeric with decimal point, like 5.2 '0110001'B Signed numeric value, like -5 '0111001'B Signed numeric with decimal point, like -5.2
Top |
Specifies whether the value that is passed to the CPP is changed from lowercase to uppercase, or is preserved in the case specified on for the command parameter.
Top |
Specifies the coded character set identifier (CCSID) to use when passing the element value.
Top |
Identifies if the keyword value is to be shown in the job log or in a prompt display.
Top |
Specifies the choices text that is displayed to the right of the input field on the prompt screen. Up to 30 characters of text can be displayed.
The following are examples of possible choices text generated by CHOICE(*VALUES):
1.0-999.9, *NOMAX
Name, *ALL, *LIBL, *CURLIB
*ALL, *ALRTBL, *BNDDIR...
Top |
Specifies the program to be called during command prompting to fill in the possible choices text and the permissible values. This parameter must be specified if *PGM is specified on the Choice text (CHOICE) parameter and may not be specified otherwise.
Single values
Qualifier 1: Choice program
Qualifier 2: Library
Top |
Specifies the length of the input field initially displayed for the element when the command is prompted. The user can extend the field to a maximum length of 512 bytes by entering an ampersand (&) in the first position of the field, followed by a blank. INLPMTLEN is valid only if TYPE is specified as *CHAR, *NAME, *SNAME, *CNAME, *PNAME, *GENERIC, or *HEX. If FULL(*YES), RSTD(*YES), or CONSTANT are specified, INLPMTLEN(*CALC) must be specified or defaulted.
Top |
Specifies the prompt text, if any, is that used for the list item (defined in this ELEM statement). The prompt text gives a short description of the element which appears next to the element input field when the command is prompted. Prompt text cannot be specified if *ZEROELEM is specified for the Type of value (TYPE) parameter, or if a constant value is specified for the Constant value (CONSTANT) parameter.
Top |
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.
Top |
None
Top |