Making one variable dependent on another

You can have variables that depend on other variables or on a substring of other variables. For example, the message class and print destination might both depend on the z/OS® system that a job runs on. If you make the message class (MSGC) and destination (DEST) variables dependent on the system (SYSTEM) variable, you need only change the value of the system variable, and the others are given the correct value.

Follow these steps to specify a dependent variable (MSGC in this example) based on the value of another variable (SYSTEM in this example):
  1. Enter the DEP command from the MODIFYING A JCL VARIABLE panel. You see the JCL VARIABLE DEPENDENCY VALUE LIST panel, shown in EQQJVDVL - JCL variable dependency value list.
    Figure 1. EQQJVDVL - JCL variable dependency value list
    EQQJVDVL ------------ JCL VARIABLE DEPENDENCY VALUE LIST ----  ROW 1 TO 2 OF 2
    Command ===>                                                  Scroll ===> PAGE
    
    Enter any of the row commands below:
    I(nn) - Insert, R(nn), RR(nn) - Repeat, D(nn) - Delete
    Enter DEL   command to delete this dependency.
    
    Dependent variable    : MSGC              message class
    Variable table        : PAY               test jcl variables
    Default value         :
    
    INDEPENDENT                SUBSTRING           SUBSTRING
    VARIABLE ===> SYSTEM       START ===>          LENGTH ===>
    Row
    cmd
    '' VALUE OF INDEPENDENT ===> ANY
       VALUE OF DEPENDENT   ===> Q
    
    '' VALUE OF INDEPENDENT ===> *
       VALUE OF DEPENDENT   ===> H
  2. Specify the system as the independent variable.
  3. For each value of the independent variable (SYSTEM), specify the associated value of the dependent variable (MSGC). Make sure that you specify the independent variable in the correct case, it is case-sensitive, and any in EQQJVDVL - JCL variable dependency value list does not give the same result as ANY.

    If there are many values of SYSTEM with the same value of MSGC, make that value of MSGC the default, and do not specify those values of SYSTEM: if there is no match, MSGC takes its default value.

  4. When you create the JCL, make sure that the independent variable occurs first, or the result is unpredictable.
    //*%OPC SCAN
    //JOB6     JOB  (&ACCT.,NOBO),'SAMPLE',
    //      MSGCLASS=&MSGC.,NOTIFY=XRAYNER,CLASS=A
    /*JOBPARM SYSAFF=&SYSTEM.
    //*MAIN SYSTEM=&SYSTEM.
    //OUTPUT1 OUTPUT DEST=&DEST,DEFAULT=NO

    In this example, the job will fail if MSGC depends on SYSTEM, because the MSGC variable occurs first.

    Change the JCL by inserting a comment card before the first dependent variable:

    //*%OPC SCAN
    //* THE VALUE OF SYSTEM IS &SYSTEM.
    //JOB6     JOB  (&ACCT.,NOBO),'SAMPLE',
    //      MSGCLASS=&MSGC.,NOTIFY=XRAYNER,CLASS=A
    /*JOBPARM SYSAFF=&SYSTEM.
    //*MAIN SYSTEM=&SYSTEM.
    //OUTPUT1 OUTPUT DEST=&DEST,DEFAULT=NO
To specify a dependent variable based on a substring of the independent variable, use the SUBSTRING fields. For example, suppose that:
  • The SYSTEM variable is set to ZOS18P1 or ZOS18T1, depending on your JCL runs in a production or a test system.
  • The input for your JCL must be TWSZ.PROD.IN or TWSZ.TEST.IN, depending on your JCL runs in a production or a test system.
You can define DSNQL as dependent variable as follows:
Figure 2. EQQJVDVL - JCL variable dependency on a substring
EQQJVDVL ------------ JCL VARIABLE DEPENDENCY VALUE LIST ----  ROW 1 TO 2 OF 2
Command ===>                                                  Scroll ===> PAGE

Enter any of the row commands below:
I(nn) - Insert, R(nn), RR(nn) - Repeat, D(nn) - Delete
Enter DEL   command to delete this dependency.

Dependent variable    : DSNQL
Variable table        : TESTVAR
Default value         : Y

INDEPENDENT                SUBSTRING           SUBSTRING
VARIABLE ===> SYSTEM       START ===> 6        LENGTH ===>1

Row
cmd
'' VALUE OF INDEPENDENT ===> P
   VALUE OF DEPENDENT   ===> PROD

'' VALUE OF INDEPENDENT ===> T
   VALUE OF DEPENDENT   ===> TEST

Then you can reference TWSZ.&DSNQL..IN in your JCL and run it in both your systems.