Dependent Definition (DEP)

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.

Parameters

Keyword Description Choices Notes
CTL Controlling conditions Single values: *ALWAYS
Other values: Element list
Required, Positional 1
Element 1: Keyword or keyword reference Character value
Element 2: Relational operator *GT, *EQ, *GE, *NL, *LT, *NE, *LE, *NG
Element 3: Value or keyword reference Character value
PARM Dependent parameter Values (up to 25 repetitions): Element list Required, Positional 2
Element 1: Keyword or keyword reference Character value
Element 2: Relational operator *GT, *EQ, *GE, *NL, *LT, *NE, *LE, *NG
Element 3: Value or keyword reference Character value
NBRTRUE Number of true dependencies Single values: *ALL
Other values: Element list
Optional, Positional 3
Element 1: Relational operator *GT, *EQ, *GE, *NL, *LT, *NE, *LE, *NG
Element 2: Number to be true 0-25
MSGID Message identifier Name, *NONE Optional, Positional 4

Controlling conditions (CTL)

Specifies the controlling conditions that must be true before the parameter dependencies defined in the PARM statement must be true. The first keyword specified identifies the controlling parameter. The controlling condition can be specified by a keyword name only, or by a keyword name and a test relationship that determines whether the controlling condition requires the presence of the parameters it depends on. The relationship between the controlling parameter and a specified value can be tested to determine if the condition specified is met. If it is, the parameters that the controlling parameter depends on must meet the requirements specified in the PARM and NBRTRUE keywords.

Single values

*ALWAYS
The parameter dependency is always checked, regardless of the form of the command.

Other values

keyword-name
Specify the keyword name of the parameter for which a value must be specified to control dependency. The keyword name is the name of the parameter that was specified by the Keyword (KWD) parameter on the PARM statement defining it. If the keyword was specified, the parameter dependency is checked. The keyword name cannot refer to a command parameter defined with TYPE(*NULL).
&keyword-name relational-operator value
Specify the keyword name of the controlling parameter followed by a relational operator (such as *LE or *EQ) and a value to be tested. If the tested condition is met, the parameters that the controlling parameter depends on must meet the requirements specified for the PARM keyword. The value must be no longer than 32 bytes. The keyword name cannot refer to a command parameter defined with TYPE(*NULL).

If the value being tested against has been specified as a special value or single value, using the SPCVAL parameter or the SNGVAL parameter of the PARM statement, the to-value must be used rather than the from-value.

The keyword name must be preceded by an ampersand (&) to indicate that the value of the keyword is tested if the relational operator and value are specified; the ampersand must not be used if the relational operator and value are not specified.

(&keyword-name relational-operator &keyword-name)
Specify the keyword name of the controlling parameter followed by a relational operator (such as *EQ) and the keyword name of another parameter whose value is compared with the value of the controlling parameter. The keyword names cannot refer to command parameters defined with TYPE(*NULL) or PASSVAL(*NULL).

Dependent parameter (PARM)

Specifies the parameter dependencies that must be tested if the controlling conditions defined by the CTL parameter are true. The dependencies can be the names of one or more parameters that are tested for their presence, or one or more test relationships of keyword values to other keyword values or constant values. A maximum of 25 parameter dependencies can be specified for this parameter. Keyword names cannot refer to command parameters defined with TYPE(*NULL).

keyword-name
Specify the keyword name of each parameter that must have a value specified for it.
&keyword-name relational-operator value
Specify the keyword name of each parameter followed by a relational operator and a value to be tested. An ampersand must precede the keyword name to indicate that the value of the keyword is tested. The value must be no longer than 32 bytes.

If the value being tested against has been specified as a special value or single value, using the Special values (SPCVAL) parameter or the Single values (SNGVAL) parameter of the PARM statement, the to-value must be used rather than the from-value.

&keyword-name relational-operator &keyword-name
Specify the keyword name of one parameter followed by a relational operator and the keyword name of another parameter whose value is compared with the value of the first parameter. The keyword names cannot refer to command parameters defined with PASSVAL(*NULL).

Number of true dependencies (NBRTRUE)

Specifies the number of parameter dependencies (defined in the PARM parameter on this DEP statement) that must be true. Otherwise, a diagnostic message (defined in the MSGID parameter on this DEP statement) is sent and the command is not run.

CL variables cannot be coded for either element of this parameter.

Single values

*ALL
All the parameter dependencies must be true. This is the same as specifying NBRTRUE(*EQ n), where n is the number of parameter dependencies defined in the PARM parameter.

Element 1: Relational operator

relational-operator
Specify a relational operator. Valid values are *GT, *EQ, *GE, *NL, *LT, *NE, *LE, and *NG.

Element 2: Number to be true

0-25
Specify the number of parameter dependencies that must be true to satisfy the specified relationship.

Message identifier (MSGID)

Specifies the diagnostic message that is to be sent to the user if the logical expression specified by the NBRTRUE parameter evaluates as false.

*NONE
No specific diagnostic message is sent. Instead, generic message CPD0150 is sent. Depending on the number of parameters on the command, it can be very difficult to determine the cause of the interparameter syntax error from the generic message text.
message-identifier
Specify the message identifier of the diagnostic message sent to the user.

Messages whose identifiers begin with the 3-character prefixes CPF or CPD are retrieved from the IBM-supplied message file QCPFMSG. All other messages specified here are retrieved from the message file identified by the MSGF parameter on the CRTCMD command which is used to create the command being defined with these dependencies. Variables cannot be coded for this parameter.

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.

Error messages

None