CL Command Reference - DEP

CL Command List > DEP Reference

Description:

The Dependent Definition (DEP) command definition statement defines a required relationship between parameters and parameter values that must be checked. This relationship can refer to either the specific value of a parameter or parameters, or to the required presence of parameters.

DEP statements provide a second level of parameter syntax checking for a CL command. The first level is provided by the PARM, QUAL, and ELEM statements that define the type of value (like *NAME or *DATE), as well as parameter value restrictions such as a the range of valid values or a list of valid values. DEP statements allow you to verify that combinations of parameter values are syntactically correct within the command string.

DEP statements can only check the first value of a specified parameter. If you want to do syntax checking for a parameter that accepts a list of values or a parameter with multiple elements or qualifiers, a validity checking exit program can be written to do a third level of syntax check for the command string. Doing syntax checking in the PARM, QUAL, ELEM or DEP statements, or in a validity checking program, can remove or greatly simplify parameter syntax checking code in your command processing program.

If a parameter has a default value and the parameter is not specified, the checking differs depending on whether the DEP statement is performing a specification check or a relational check. If a specification check is made on an unspecified parameter (checking for the presence of a value for that parameter), the system assumes that no value was specified, and the default value is not used. If a relational check is made on an unspecified parameter, the default value is used as the parameter value in the relational check.


Examples:

Example 1: Checking the Presence of a Parameter

DEP CTL(&TYPE *EQ LIST) PARM(ELEMLIST)

If TYPE(LIST) is specified, the ELEMLIST parameter must be specified. If TYPE(LIST) and no value is specified for the ELEMLIST parameter, generic diagnostic message CPD0150 is sent and the command is not run.



Example 2: Checking the Presence of Multiple Parameters

DEP CTL(FILE) PARM(VOL LABEL) +
NBRTRUE(*EQ 2) MSGID(USR1234)

If the FILE parameter is specified, both the VOL and LABEL parameters must be specified. If only one of the VOL and LABEL parameters have a value specified, or if neither parameter is specified, diagnostic message USR1234 is sent and the command is not run. Command analyzer will look for message USR1234 in the message file specified for the MSGF parameter on the CRTCMD command.



Example 3: Checking for Mutually Exclusive Parameters

DEP CTL(*ALWAYS) PARM(J1 D J2) NBRTRUE(*EQ 1)

A value must be specified for one (and only one) of the J1, D, and J2 parameters. If zero or two or three of these parameters are specified, generic diagnostic message CPD0150 is sent and the command is not run.



Example 4: Checking One or More Conditions are True

DEP CTL(&LIB *EQ MYLIB) +
PARM((&PASSWORD *EQ XYZ5) (&USRPRF *EQ B0BJ)) +
NBRTRUE(*GE 1) MSGID(MSG1001)

If the LIB parameter value is MYLIB, the PASSWORD parameter value must be XYZ5, or the USRPRF parameter value must be BOBJ, or both PASSWORD(XYZ5) and USRPRF(BOBJ) must be specified. If LIB(MYLIB) and neither of the dependency conditions specified are true, diagnostic message MSG1001 is sent and the command is not run.



Example 5: Checking for a Conditionally Required Parameter

DEP CTL(&OUTPUT *EQ *OUTFILE) PARM((&OUTFILE *NE ¡¯ ¡¯)) +
NBRTRUE(*EQ 1) MSGID(CPD9861)
DEP CTL(&OUTPUT *NE *OUTFILE) PARM((&OUTFILE *EQ ¡¯ ¡¯)) +
NBRTRUE(*EQ 1) MSGID(CPD9862)
DEP CTL(&OUTMBR *NE *FIRST) PARM((&OUTFILE *EQ ¡¯ ¡¯)) +
NBRTRUE(*EQ 0) MSGID(CPD9867)

Three related interparameter checks will be made:

1. If the OUTPUT parameter has a value of *OUTFILE, the OUTFILE parameter must have a non-blank value specified. Otherwise, message CPD9861 is sent. Since the message identifier starts with ¡¯CPD¡¯, the operating system will look for the message in message file QCPFMSG. Assuming the OUTFILE parameter is a qualified object name, only the value of the first QUAL will be checked.

2. If the OUTPUT parameter has a value other than *OUTFILE, the OUTFILE parameter must be blank, assuming that the OUTFILE parameter was coded as MIN(0) and with no default (DFT) value. Otherwise, message CPD9862 is sent.

3. If the OUTMBR parameter has any value other than *FIRST, the OUTFILE parameter must have a non-blank value specified. Otherwise, message CPD9867 is sent. Assuming the OUTMBR parameter is a list of two elements, only the value of the first ELEM will be checked.