2.7 SUBCOMMANDS

Subcommands may be declared in a PDF. A subcommand determines the variables associated with a collection of given invocation of the proc. A subcommand name has fifteen or fewer characters.

For example, consider the hypothetical TAPE command's PDF:

PROCESS
PARM INTAPE TYPE=(STRING, 10)

SUBCMD  COPY
    PARM OUTTAPE TYPE=(STRING, 10)
    PARM FILES TYPE=INTEGER DEFAULT=1
    PARM ERROR TYPE=(STRING,12) DEFAULT=CONTINUE+
          VALID=(STOP, CONTINUE, REPORT)
END-SUBCMD

SUBCMD  REWIND
END-SUBCMD

SUBCMD  SPACE
    PARM FILES TYPE=INTEGER DEFAULT=1
    LOCAL I TYPE=INTEGER
END-SUB CMD

END-PROC

The SUBCMD and END-SUBCMD commands bracket the parameters associated with a given subcommand. Because the declaration of the INTAPE parameter is outside SUBCMD/END-SUBCMD brackets, it is a parameter common to all subcommands.

Examples of TCL references to the TAPE proc are:

TAE> TAPE-REW INTAPE=MTA5

TAE> TAPE-COPY MTA5,MTA2,25,STOP

TAE> TAPE-SPACE INTAPE=HTA5, FILES=1O

TAE> TUTOR TAPE-REWIND

TAE> TUTOR TAPE

In the TAPE example there is no default subcommand; the default must be explicitly specified. The SUBCMD-DEFAULT command (e.g., "SUBCMD-DEFAULT COPY") declares the "default" subcommand. The default subcommand is assumed when the subcommand specifier is omitted in a reference to the proc.