Defining CL command parameters

To define a CL command parameter, you must use the PARM statement.

You can define as many as 99 parameters for each command.

On the PARM statement, you specify the following:

  • Name of the keyword for the parameter
  • Whether the parameter is a key parameter
  • Type of parameter value that can be passed
  • Length of the value
  • If needed, the default value for the parameter.

In addition, you must consider the following information when defining parameters. (The associated PARM statement parameter is given in parentheses.)

  • Whether a value is returned by the command processing program (RTNVAL). If RTNVAL (*YES) is specified, a return variable must be coded on the command when it is called, if you want to have the value returned. If no variable is specified for a RTNVAL(*YES) parameter, a null pointer is passed to the command processing program.
  • Whether the parameter is not to appear on the prompt to the user but is to be passed to the command processing program as a constant (CONSTANT).
  • Whether the parameter is restricted (RSTD) to specific values (specified on the VALUES, SPCVAL, or SNGVAL parameter) or can include any value that matches the parameter type, length, value range, and a specified relationship.
  • What the specific valid parameter values are (VALUES, SPCVAL, and SNGVAL).
  • What tests should be performed on the parameter value to determine its validity (REL and RANGE).
  • Whether the parameter is optional or required (MIN).
  • How many values can be specified for a parameter that requires a simple list (MIN and MAX).
  • Whether unprintable data (any character with a value of hexadecimal 00 through 3F or FF can be entered for the parameter value (ALWUNPRT).
  • Whether a variable name can be entered for the parameter value (ALWVAR).
  • Whether the value is a program name (PGM).
  • Whether the value is a data area name (DTAARA).
  • Whether the value is a file name (FILE).
  • Whether the value must be the exact length specified (FULL).
  • Whether the length of the value should be given with the value (VARY).
  • Whether expressions can be specified for a parameter value (EXPR).
  • Whether attribute information should be given about the value passed for the parameter (PASSATR).
  • Whether to pass a value to the command processing program or validity checking program if the parameter being defined is not specified (PASSVAL).
  • Whether the case value is preserved or the case value is converted to uppercase (CASE).
  • Whether list within list displacements (LISTDSPL) are 2-byte or 4-byte binary values.
  • What the message identifier is or what the prompt text for the parameter is (PROMPT).
  • What valid values are shown in the possible choices field on the prompt display (CHOICE).
  • Whether the choice values are provided by a program (CHOICEPGM).
  • Whether prompting for a parameter is controlled by another parameter (PMTCTL).
  • Whether values for a PMTCTL statement are provided by a program (for parameters referred to in CTL keywords) (PMTCTLPGM).
  • Whether the value is to be hidden in the job log or hidden when the command is being prompted (DSPINPUT).