Example: Substituting a default value

This example shows how to define and create a CL command that provides defaults for an IBM-supplied CL command.

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.

You can create a command that provides defaults for an IBM-supplied command and reduces the entries that the display station user must make. For example, you could create a Save Library to Tape (SAVLIBTAP) command that initializes a tape and saves a library on the tape device TAPE1. This command provides defaults for the standard Save Library (SAVLIB) command parameters and requires the display station user to specify only the library name.

The command definition statements for the Save Library to Tape (SAVLIBTAP) command are:


CMD PROMPT('Save Library to Tape')
PARM KWD(LIB) TYPE(*NAME) LEN(10) MIN(1) +
  PROMPT('Library Name')

The command processing program is:


PGM PARM(&LIB)
DCL &LIB TYPE(*CHAR) LEN(10)
INZTAP DEV(TAPE1) CHECK(*NO)
SAVLIB LIB(&LIB) DEV(TAPE1)
ENDPGM

The Create Command (CRTCMD) command is:


CRTCMD CMD(SAVLIBTAP) PGM(SAVLIBTAP) SRCMBR(SAVLIBTAP)