Creating a CL command

After you have defined your command through the command definition statements, use the Create Command (CRTCMD) command to create the command.

Besides specifying the command name, library name, and command processing program name for CL or high-level languages (HLL), or the source member, source file, command environment, and exit program for REXX, you can define the following attributes of the command:

  • The validity checking used by the command
  • The modes in which the command can be run
    • Production
    • Debug
    • Service
  • Where the command can be used
    • Batch job
    • Interactive job
    • ILE CL module in a batch job
    • CL program in a batch job
    • ILE CL module in an interactive job
    • CL program in an interactive job
    • REXX procedure in a batch job
    • REXX procedure in an interactive job
    • As a command interpretively processed by the system through a call to QCMDEXC or QCAPCMD.
  • The maximum number of parameters that can be specified by position
  • The message file containing the prompt text
  • The help panel group that is used as help for promptable parameters
  • The help identifier name for the general help module used on this command
  • The message file containing the messages identified on the DEP statement
  • The current library to be active during command processing
  • The product library to be active during command processing
  • Whether an existing command with the same name, type, and library is replaced if REPLACE(*YES) is specified.
  • The authority given to the public for the command and its description
  • Text that briefly describes the command and its function

For commands with REXX CPPs, you can also specify the following:

  • The initial command environment to handle commands when the procedure is started
  • Exit programs to control running of your procedure

The following example defines a command named ORDENTRY to call an order entry application. The CRTCMD command defines the preceding attributes for ORDENTRY and creates the command using the parameter definitions contained in the member ORDENTRY in the IBM-supplied source file QCMDSRC. ORDENTRY contains the PARM statement used in the example under Example: Defining a CL command parameter.


CRTCMD     CMD(DSTPRODLB/ORDENTRY) +
           PGM(*LIBL/ORDENT) +
           TEXT('Calls order entry application')

The resulting command is as follows where the value can be DAILY, WEEKLY, or MONTHLY:


ORDENTRY  OETYPE(value)

After you have created a command, you can perform the following tasks:

  • Display the attributes of the command by using the Display Command (DSPCMD) command
  • Change the attributes of the command by using the Change Command (CHGCMD) command
  • Delete the command by using the Delete Command (DLTCMD) command