Parameters Examples Error messages |
The Parameter (PARM) command definition statement defines a parameter of a command being created. A parameter is the means by which a value is passed to the command processing program. One PARM statement must be used for each parameter that appears in the command being defined. The order in which the PARM statements are entered into the source file determines the order in which the parameters must be specified when the command is entered in positional form and the order in which they are passed to the validity checker and the command processing program. A maximum of 99 parameters can be defined for one command. A command with a large number of parameters will require more processing time before the command processing program is called, regardless of how many parameters are actually coded.
Note: The PARM statement contains certain parameters and predefined values that can be used only when IBM-supplied command processing programs are called by the command being defined. Because of limitations in some high-level languages, these values may not be useful in the definition statements of user-defined commands. These parameters and values are identified by the phrase (For IBM-supplied commands) that immediately follows the parameter keyword (if the entire parameter is for IBM-supplied commands only) or the predefined value to which it applies.
Top |
Keyword | Description | Choices | Notes |
---|---|---|---|
KWD | Keyword | Simple name | Required, Positional 1 |
TYPE | Type of value | Simple name, *DEC, *LGL, *CHAR, *INT2, *INT4, *NAME, *GENERIC, *VARNAME, *DATE, *TIME, *CMD, *X, *HEX, *ZEROELEM, *NULL, *CMDSTR, *PNAME, *UINT2, *UINT4, *SNAME, *CNAME | Required, Positional 2 |
LEN | Value length | Values (up to 3 repetitions): Integer | Optional, Positional 3 |
RTNVAL | Return value | *NO, *YES | Optional |
CONSTANT | Constant value | Character value | Optional |
RSTD | Restricted values | *NO, *YES | 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 or keyword reference | Character value | ||
RANGE | Range of values | Element list | Optional |
Element 1: Lower value or keyword ref | Character value | ||
Element 2: Upper value or keyword ref | 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 PARM a program name | *NO, *YES | Optional |
DTAARA | Is PARM a data area name | *NO, *YES | Optional |
FILE | If a file parameter, how used | *NO, *IN, *OUT, *UPD, *INOUT, *UNSPFD | Optional |
FULL | Full field required | *NO, *YES | 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 | *NO, *YES | Optional |
PASSVAL | Value to pass if unspecified | *DFT, *NULL | Optional |
CASE | Case of value | *MONO, *MIXED | Optional |
CCSID | CCSID of value | *JOB, *UTF16 | Optional |
LISTDSPL | List displacement | *INT2, *INT4 | 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 | ||
PMTCTL | Prompt control | Simple name, *NONE, *PMTRQS | Optional |
PMTCTLPGM | Prompt control program | Single values: *NONE Other values: Qualified object name |
Optional |
Qualifier 1: Prompt control program | Name | ||
Qualifier 2: Library | Name, *LIBL, *CURLIB | ||
KEYPARM | Key parameter | *NO, *YES | Optional |
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 specifications | Single values: *NONE Other values: Element list |
Optional |
Element 1: Prompt text or message ID | Character value | ||
Element 2: Order prompt is displayed | Integer |
Top |
Specifies the keyword name of the parameter being defined. Every CL command parameter has an associated keyword name. Command parameters specified using the parameter keyword can be specified in any order. Parameters may be specified in positional form (without a keyword name) up to the positional limit specified by the MAXPOS parameter on the Create Command (CRTCMD) command.
Top |
Specifies the type of the value that can be specified for the parameter named in KWD. The value can be an integer, a decimal, hexadecimal, or logical value, or a character string (optionally enclosed in apostrophes) that can be a name, date, or time. The value can also be a command. Type one of the following options to specify the parameter type:
The command analyzer rebuilds the command string when it checks it for validity. When the command is rebuilt, keywords are added to parameters that were specified positionally, parameters can be reordered, and parameters that contain characters that cannot be printed (X'FF' and X'00 - X'3F') are converted to hexadecimal notation. As a result, the rebuilt command string may be substantially longer than the original command string. If the length of the rebuilt command is longer than the allowed length specified with the LEN keyword, the command will fail.
Note: Selective prompting is not allowed with the *CMDSTR parameter.
Top |
Specifies the length of the parameter value that is passed to the command processing program. This parameter is not allowed if *INT2, *INT4, *UINT2, *UINT4, *DATE, *TIME, *CMD, *ZEROELEM, *NULL, or a statement label is specified for the Type of value (TYPE) parameter. With other values specified for the Type of value (TYPE) parameter, this parameter has the following applications:
Top |
Specifies whether a value is returned by the command processing program through the parameter being defined in this PARM statement.
Top |
Specifies that a value is passed to the command processing program as a constant when the command being defined is processed; the parameter does not appear externally on the command. The value specified in this parameter (if any) 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.
If a constant is specified for the parameter being defined, no prompt text can be specified for the Prompt specifications (PROMPT) parameter because the parameter will not be prompted.
This parameter is not valid for the following:
Variables cannot be coded for this parameter.
Top |
Specifies whether the value entered for the parameter (specified in the PARM 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 whether 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 parameter if a value is not specified by the user. That is, the default value is used as the value of the parameter if the user omits the parameter while entering the command or if the user specifies *N as the parameter value. The default value must satisfy one of the following:
This parameter is not valid if the Constant value (CONSTANT) parameter is specified. This parameter is valid only if 0 is specified for the Minimum values required (MIN) parameter, which means the parameter named in the Keyword (KWD) parameter is optional. No default can be specified if RTNVAL(*YES) is specified on the Return value (RTNVAL) parameter; instead, a null pointer is passed for the default. A default cannot be specified if *CMD, *ZEROELEM, or *NULL is specified on the Type of value (TYPE) parameter. If *VARNAME is specified on the Type of value (TYPE) parameter, a default special value can be specified; a default variable name cannot be specified.
An assumed default value is not displayed by the command prompt; a blank input field is shown instead. If a default is specified, 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 entered as the value of the parameter named on the Keyword (KWD) parameter. 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. Type the constants (not more than 300) that can be specified as the value of the parameter. This parameter is not valid if *CMD, *CMDSTR, *X, *NULL, statement label, *VARNAME, or *ZEROELEM is specified on the Type of value (TYPE) parameter, or if *YES is specified on the Return value (RTNVAL) parameter.
Top |
Specifies the relationship between the parameter value of this parameter and the value of a constant or another parameter. If a keyword is specified, it must be preceded by an ampersand (&) to indicate that it is the value of the keyword that is to be tested. The value associated with the referred to keyword is the value passed to the command processing program, not the user-specified value. If the relationship is with another parameter whose value is a list of values or a qualified name, the first value only is used in the comparison.
To specify the relationship, enter one of the following relational operators followed by either a constant or the keyword name of the other parameter (which must be preceded by an &).
The REL parameter is not valid in the following cases:
If a *CHAR (character type) is specified on 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.
Variables can be coded for this element.
Top |
Specifies the range, or limits, for the parameter value. The parameter 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. For example, 15 would be valid if RANGE was specified as (0 16).
For nonnumeric data types, such as character, the range of values and the data specified are 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.
Variables can be coded for this element.
The upper and lower limits of the range can be specified either by a keyword representing the value or by the value itself. If a keyword is specified, it must be preceded by an ampersand (&) to indicate that the value of the keyword is to be tested. The value of its parameter at the time of the check is used to determine the range. The value that is tested is the value passed to the command processing program, not the user-specified value. If the keyword identifies a list of values or a qualified name, only the first value is used as the range limit. A keyword may not refer to a parameter that is defined with *NULL specified on the Value to pass if unspecified (PASSVAL) parameter. This parameter is not valid with *NULL specified on the Value to pass if unspecified (PASSVAL) parameter.
This parameter is also not valid in the following cases:
Character constants specified in this parameter can be no longer than 32 characters.
Variables can be coded for this element.
Top |
Specifies a list of up to 300 entries that define special values that can be entered on the parameter. Each entry specifies a character string (a 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 *YES is specified on the Return value (RTNVAL) parameter, or if *CMD, *CMDSTR, *X, *ZEROELEM, *NULL, or a statement label is specified for the Type of value (TYPE) parameter.
The from-value is a character string, but the to-value can be anything that is passable. However, for TYPE(*DATE) the to-value must be specified not quoted in the mmddyy, mmddyyyy, or the Cyymmdd format. If a CL variable is used for the from-value, its type must be *CHAR. The to-value must be no longer than 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 the Type of value (TYPE) parameter is a character type (such as *CHAR, *LGL or *DATE), 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.
If a to-value of *CURLIB is specified, the name of the current library, rather than the value *CURLIB, is passed to the CPP. 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 a list of up to 300 single values that can be specified for a parameter being defined as a mixed list or as a qualified name, when a statement label is specified for the Type of value (TYPE) parameter, or specifies that it is to accept two or more values as defined by the Maximum values allowed (MAX) parameter. Any one of the single values can be entered instead of a list of values or a qualified name that the parameter is defined to accept. Each entry specifies a character string (a 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 without further checking. If the to-value is omitted, the from-value is passed to the command processing program.
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 1 or if TYPE is specified as a statement label of a QUAL or ELEM statement. Each single value can only be substituted for a list of values or a qualified name; it cannot be a list item or qualifier. It is passed as the first and only element of the list.
This parameter is not valid if *YES is specified on the Return value (RTNVAL) parameter, or if *CMD, *CMDSTR, *X, *ZEROELEM, *NULL, or a statement label is specified for the Type of value (TYPE) parameter.
If a to-value of *CURLIB is specified, the name of the current library, rather than the value *CURLIB, is passed to the command processing program. 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 command processing program.
Variables cannot be coded for this element.
Top |
Specifies the minimum number of values that must be entered for the parameter being defined. For a parameter that does not allow multiple like values, only zero (0) for optional and 1 for required can be specified as the minimum number of values.
Note: Required parameter statements must precede optional statements. If required parameter statements are not specified first, the system assumes that the specified parameter is optional, and the minimum number of values for required parameters is ignored.
For a parameter that allows multiple like values, because a value greater than 1 is specified for the Maximum values allowed (MAX) parameter, zero (0) indicates that no values need be entered; therefore, it is an optional parameter. A value of 1 or greater than 1 indicates the minimum number of values that must be entered for the parameter, and, therefore, it is a required parameter. The value cannot exceed 1 if *NULL is specified for the Type of value (TYPE) parameter.
Top |
Specifies, if this PARM statement is defining a simple list parameter, the maximum number of list items that this list parameter can contain. If a value greater than 1 is specified, the parameter is capable of accepting multiple like values (that is, a simple list). This support is primarily intended for IBM-supplied commands. All values entered for this parameter (at the time the command is run) must satisfy the validity checking requirements specified by the other parameter values on this PARM statement.
Note: The values for a list parameter are passed consecutively, preceded by a 2-byte binary value that indicates the number of values entered in the parameter by the user. CL programs do not support the handling of binary values in variables.
Top |
Specifies whether this PARM statement accepts the hexadecimal characters above X'FF' or those in the range of X'00' through X'3F'. This parameter is valid only if *CHAR or *X is specified for the Type of value (TYPE) parameter.
Top |
Specifies whether to allow variable names for the parameter. *NO is not allowed on this parameter if *VARNAME, *ZEROELEM, *NULL, or a statement label is specified on the Type of value (TYPE) parameter.
Top |
Specifies whether this parameter 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. Specifying *YES here does not have any effect on the parameter element being defined by the PARM statement; it only indicates to the compiler that the value for this parameter 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 parameter 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. Specifying *YES here does not have any effect on the parameter being defined by the PARM statement; it only indicates to the compiler that the value for this parameter 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 the expected use of the file and whether the parameter is a file name. The parameter 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. The specification in this parameter does not have any effect on the operation of the parameter being defined; it only indicates to the compiler that the value for this parameter is a file name and what type of file it is. This information is stored so it can be included in the output of the Display Program References (DSPPGMREF) command. This parameter is valid only if a statement label, *CHAR, *NAME, *SNAME, *CNAME, or *GENERIC is specified for the Type of value (TYPE) parameter. It is not valid if *YES is specified on the Return value (RTNVAL) parameter.
The use of the file must match the type of file specified. For example, if *IN is specified, the file can be used only for input; if *UPD is specified, it can be used only to update existing records.
Top |
Specifies whether the number of characters in the parameter must be exactly the same as the number specified on the Value length (LEN) parameter (if specified) or its default length (if LEN is not specified).
Top |
Specifies whether the parameter named in the KWD parameter can accept an expression containing a character concatenation or a built-in function (%SUBSTRING or %BIN).
Restrictions: Expressions are not allowed on parameters where *CMD, *ZEROELEM, *NULL, or a statement label is specified for the Type of value (TYPE) parameter.
Top |
Specifies whether the value that is passed to the command processing program is preceded by a length value that indicates the number of characters entered for the command parameter.
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.
Single values
Element 1: Return length value
Element 2: Value length
Top |
Specifies whether an attribute byte is passed to the command processing program with the parameter data.
The attribute byte precedes the parameter data. If the parameter 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 a value is passed to the command processing program for this parameter. *NULL is not valid if the parameter is a constant parameter (a parameter in which a value has been specified for the Constant value (CONSTANT) parameter, or a parameter for which *ZEROELEM or *NULL has been specified for the Type of value (TYPE) parameter, or a list/qualified name defined by all constant ELEM or QUAL statements). *NULL also is not valid if *YES has been specified on the Return value (RTNVAL) parameter, or if the value specified for the Minimum values required (MIN) parameter is greater than zero. A DEP statement or the REL and RANGE keywords of other PARM statements may not refer to the value of a parameter defined with *NULL.
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 parameter value.
Top |
Specifies whether the displacement to a list within a list is 2-bytes or 4-bytes long. These displacements are generated when a parameter being passed to a CPP has a list within a list. This parameter is ignored if the value being built for the CPP does not contain a list within a list.
Top |
Specifies whether the keyword value is 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 how prompting is be controlled for this parameter. Prompting may be controlled by another parameter, specified by a Prompt Control (PMTCTL) statement referred to by label in this parameter, or by user request by pressing the F10 key.
Top |
Specifies the program to be called to convert the value specified for the parameter into a value used on a Prompt Control (PMTCTL) statement. This parameter is valid only on parameters that are referred to in the Controlling keyword (CTL) parameter of a PMTCTL statement.
Single values
Qualifier 1: Prompt control program
Qualifier 2: Library
Top |
Specifies that this parameter is initially displayed when the command is prompted and a prompt override program was specified when the command was created or changed. If no prompt override program is specified, KEYPARM(*NO) is assumed for all parameters.
Top |
Specifies the length of the input field initially displayed for the parameter 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, *CMDSTR, *HEX, *X, or *CMD. If FULL(*YES), RSTD(*YES), or CONSTANT are specified, INLPMTLEN(*CALC) must be specified or defaulted.
Top |
Specifies what prompt text is used for the parameter. The prompt text gives a short description of the parameter which appears next to the parameter keyword and input field when the command is prompted. Prompt text cannot be specified if *ZEROELEM or *NULL is specified for the Type of value (TYPE) parameter, or if a constant value is specified in the Constant value (CONSTANT) parameter.
Single values
Element 1: Prompt text or message ID
Element 2: Order prompt is displayed
Top |
Example 1: Define a Numeric Parameter
PARM KWD(X) TYPE(*DEC) LEN(2) MIN(1) REL(*GT 5)
The value for the parameter named X, a 2-digit decimal number, must be entered. The value must be greater than 5.
Example 2: Define a Parameter with Restricted Values
PARM KWD(CLASS) TYPE(*CHAR) LEN(1) DFT(A) + VALUES(A B C) RSTD(*YES)
The value of the parameter named CLASS must be A, B, or C, if specified. If CLASS is not specified, the default value passed to the command processing program will be A.
Example 3: Define a Parameter with Range of Valid Values
PARM KWD(MAXREC) TYPE(*DEC) LEN(3 0) MIN(1) + RANGE(&MINREC 500)
The value of the MAXREC parameter must be entered as a decimal number of 3 digits or less, with no digits to the right of the decimal point. The value must be greater than or equal to the value entered (or defaulted) for parameter MINREC and also must be less than or equal to 500.
Example 4: Define a Simple List Parameter
PARM KWD(FILES) TYPE(*NAME) MIN(2) MAX(5)
The FILES parameter is a homogeneous list that contains a minimum of two names and a maximum of five names.
Example 5: Define a List Parameter with Restricted Values
PARM KWD(INVFNAME) TYPE(*NAME) DFT(*ALL) + SNGVAL((*ALL XXX)) VALUES(DEPT1 DEPT2 DEPT3) + FILE(*UPD) MIN(0) MAX(3) RSTD(*YES) + PROMPT(USR0002 1)
The value of the parameter named INVFNAME can be a list of up to three file names of which DEPT1, DEPT2, DEPT3, and *ALL are the valid choices. If *ALL is entered, no other values can be entered for the parameter. If this parameter is omitted, file name XXX is passed to the command processing program. If this parameter is entered through a command prompter, the prompt text for this parameter will be retrieved from message identifier USR0002 of the message file specified for the PMTFILE parameter on the Create Command (CRTCMD) command when the command is created. *ALL will be shown as the default parameter value.
Top |
None
Top |