Automate JCL with CA Jobtrac Job Management.
search cancel

Automate JCL with CA Jobtrac Job Management.

book

Article ID: 49954

calendar_today

Updated On:

Products

Jobtrac

Issue/Introduction

There has always been a need to automate date cards, JCL overrides and SYSIN input parameters in batch jobs. CA Jobtrac JM provides three features which allow you to automate your JCL to handle these processes. This Knowledge Document provides and explanation and examples of these three methods.

 

Environment

Release:
Component: JOBTRC

Resolution

The Automatic JCL Override (AJO) feature allows for automatic deletion and addition of JCL statements. The Automatic Date Insertion (ADI) feature allows you to insert dates in JCL SYSIN control cards or any 80-byte JCL record. The JCL Management Facility (JMF) feature allows you to change global variables and dates in JCL or Procs. These features only work with jobs submitted by CA Jobtrac JM. These features also interface with JCLTRAC providing the correct JCL resolution and with one another. Below are sample solutions that can be used as a guideline in using each feature.

AJO
Automatic JCL Override allows for you to select JCL statements to be included in the submitted JCL by specifying a process period or generic date. For example, you run a job to execute an IEBGENER every Tuesday and the rest of the week you want it to execute an IEFBR14. You could have this set up two run two different jobs or using process periods you can do the following with AJO:

Cols.                              60                     73  
--------------------------------------------------------------------   
// job   
//SCHED EXEC PGM=IEFBR14         =M.WTFSS                I=SCHD   
//ONLYTUE EXEC PGM=IEBGENER      TUESDAY                 I=SCHD  

The above job will include JCL to do execute IEFBR14 step everyday except for Tuesdays, the IEBGENER step will be inserted only on Tuesdays. AJO can be used on any JCL statement. AJO will also allow you to specify generic dates for selection of JCL statements instead of using standard process periods. Additional information can be found in the Extended Scheduling Services Guide.

ADI
Automatic Date Insertion (ADI) is used to calculate and insert dates in the correct format in a date control card. By using ADI, you can reduce the chance of error if changes are done manually on a daily bases.

For example, you run a job that runs daily and you want the date control card to reflect the current date. You could do this manually, but there is a chance that the wrong date could be coded causing incorrect results and reruns. Below is an example of the ADI control card (ADI control card is always prefixed with a ':') following the SYSIN DD. When it is encountered, CA Jobtrac JM will insert the date or date calculation that you specified in the DATELIB PRODDATE member.

The ADIDATE date card is defined in the PRODDATE member of DATELIB file to create a date card of the format yy/mm/dd. ADI variables \Y (year), \M (month), and \D (Day) are user to define the date. The following is the definition for the ADI variable:

ADIDATE \Y/\M/\D
Here is what the JCL looks like before submission, using the ADIDATE variable.

   
   // JOB   
   //STEP1 EXEC PGM=IEBGENER   
   //SYSPRINT DD SYSOUT=*   
   //SYSUT1 DD DUMMY   
   //SYSUT2 DD SYSOUT=*   
   //SYSIN DD *  
   //:(ADIDATE)  

Here is the JCL Uncenter CA-Jobtrac will submit to the operating system:

   // JOB   
   //STEP1 EXEC PGM=IEBGENER   
   //SYSPRINT DD SYSOUT=*   
   //SYSUT1 DD DUMMY   
   //SYSUT2 DD SYSOUT=*   
   //SYSIN DD *   
   12/01/23      
       /* 
       //

Additional information can be found in the Extended Scheduling Services Guide, in section on how to define the ADI control record. Additionally, you can use ADI to insert JMF variables.

JMF
The JCL Management Facility (JMF) is the most robust of the three facilities. JMF can be used to insert JCL substitution by a date range, or it can be used to substitute any JCL statements or SYSIN data. JMF allows date arithmetic for dynamic date variables based on the CA -Jobtrac JM OSD or TOD clock. You also have the ability to restrict JMF usage by location.

Below are examples of its usage:

JMF Variables as Cataloged Procedures
You can use a JMF variable as a substitution variable of a cataloged procedure. The JMF variable is resolved before the JES expansion of the cataloged procedure.

For example, the following is in the JMFSYM01 member:

 A=PROD.SOURCE.LIST
 B=MONLOG1 

And we have a cataloged procedure called ABC as follows:

 //ABC PROC MEM='',D='' 
 //S1 EXEC PGM=IEBGENER  
 //SYSUT1 DD DISP=OLD,DSN=&D(&MEM)  
 //SYSUT2 DD SYSOUT=  
 //SYSIN DD DUMMY  
 //PEND

To invoke the above procedure we have JCL as follows:

//TESTJ1 JOB (ACCNT111),'JMF_TEST2',CLASS=A   
//STEP1 EXEC ABC,   
//      MEM=&:B,D=&:A   
// 

JMF Variables as SYSIN Data
You can use a JMF quoted variable as SYSIN DD data. The limit is 44 characters. If you want to supply a full 80 characters of data, use two JMF variables. When specifying the data portion in the JMFSYM01 member, you can include spaces in the value by enclosing the value in single or double quotes. For example:

   
   A='123456789 123456789 123456789 123456789'   
   B=AAAAAAAAAABBBBBBBBBBCCCCCCCCCCDDDDDDDDDD  

The JMF variables above each represent a 40-character string of numeric data. JMF variables A and B could be used as input to a program as follows:

      //TEST1 JOB (ACCNT 1),'JMF_TEST',   
   //CLASS=A,REGION=512K   
   //STEP1 EXEC PGM=ABCD111   
   //STEPLIB DD DISP=SHR,DSN=TEST.CONTROL.LOAD   
   //SYSUT1 DD DISP=OLD,DSN=MONTH.MASTER   
   //SYSUT2 DD DISP=(,CATLG),DSN=NEW.MONTH.MASTER,   
   // DCB=(LRECL=1 ,BLKSIZE=1 ,RECFM=FB),UNIT=SYSDA,   
   // SPACE=(TRK,(1 ,1 ),RLSE)   
   //SYSIN DD &:A.&:B &:B.&:A   
     //

JMF Variables as Positional and Keyword Values:
You can use a JMF variable as a JCL positional value. The JMF variable is resolved before the expansion of the JCL by the OS converter. For example, the following is in the JMFSYM01 member:

   
   ACT1 ="(ACCT1 1)" Positional Values   
   PRDPGM5="PAYGP_5 " Positional Values   
   TSOB1=HOU.TSO2.BKUP(+1) Keyword Values   
   EXP1="EXPDT=99365" Keyword Values 

To use the above JMF variables in a production job, the JCL could be as follows (CA Jobtrac JM
JCL member BKTSO002):

      //BKTSO 2 JOB &:ACT1 ,'&:PRDPGM5 ',CLASS=D,MSGCLASS=X   
   //DUMPTSO EXEC PGM=ADRDSSU,REGION=4 96K   
   //SYSPRINT DD SYSOUT=H   
   //   
   //FULL PACK BACKUP OF TSO 2   
   //   
   //TAPE1 DD DSN=&:TSOB1,DISP=(,CATLG,DELETE),   
   //LABEL=&:EXP1,DCB=GSI.MODDSCB,UNIT=TAPE   
   //SYSIN DD   
        DUMP -   
     DATASET(INCLUDE()-   
     EXCLUDE(.HASPACE,.HASPCKPT))-   
     ALLDATA(SYS1.JOBTRAC)-   
     INDYNAM(TSO 2,SYSALLDA)-   
     OUTDD(TAPE1)-   
     CANCELERROR -   
     TOL(ENQF)-   
     SHR         
   /*   
   //

Concatenating JMF Variables
You can concatenate previously defined JMF variables. The JMF variables are resolved before the expansion of the JCL by the OS converter. For example, the following is in the JMFSYM01 member:

    A=1234   
    B=ABCD   
    C='000999'   
    D=&:A.&:B.&:C   
    E =&:A..&:B..&:C 

D would have a value of 1234ABCD000999.
E would have a value of 1234.ABCD.000999.

You cannot use dynamic variables (&:GMM) and non-dynamic variables (A=B) elements in a concatenated string.
For example:

    A=&:GMM.&:C  

These three features allows CA Jobtrac JM to automate your JCL and prevent costly reruns. Additional information on setting up and implementing these features can be found in the Extend Scheduling Services Guide.