Parameters Examples Error messages |
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.
Top |
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 |
Top |
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
Other values
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.
Top |
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).
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.
Top |
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
Element 1: Relational operator
Element 2: Number to be true
Top |
Specifies the diagnostic message that is to be sent to the user if the logical expression specified by the NBRTRUE parameter evaluates as false.
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.
Top |
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:
Top |
None
Top |