mainframezosjcl

How to schedule a sub jcl from main jcl


For Example while executing and running up a cobol db2 program we need to submit mutilpe jcl, so need to bring all those sub-jcl under my main jcl, so that i need to submit only one jcl and compilation and execution are done.

                                      main jcl
                                  -       -      - 
                                  -       -      - 
                                jcl1     jcl2   jcl3

Constaints: I can't update the jcl1, jcl2 and jcl3.


Solution

  • JOBLIB or STEPLIB is a list of libraries which contain executables, i.e. programs. They do not contain jobs, i.e. JCLs.

    There is no such thing as a sub-JCL from an operating point of view. Each job is a separte set of JCL statements, which may be stored as member of JCL libraries, or they may be generated by a program.

    If your COBOL program needs to decide when and which job to submit, it needs to know the library and member for each job. It can then read the member from the library and write the records to an INTRDR data set. The JCL for the COBOL program could, e.g. contian DD statements for each of the three jobs and a single INTRDR DD to submit the jobs.

    //jobname JOB ....
    ...
    //stepname EXEC PGM=your-cobol-pgm
    //...
    //JOB1     DD DISP=SHR,DSN=your.jcl.lib(JOB1)
    //JOB2     DD DISP=SHR,DSN=your.jcl.lib(JOB2)
    //JOB3     DD DISP=SHR,DSN=your.jcl.lib(JOB3)
    //SUBMIT   DD SYSOUT=(A,INTRDR)
    ...
    

    I'm not a COBOL programmer, so I won't try to give example code. In the COBOL code, you declare files for each of the jobs, i.e. JOB1, JOB2, and JOB3, and one for the INTRDR, i.e. SUBMIT (Note the DD name SUBMIT was arbitrarily chosen; it can be almost any name you want).

    When it is time to submit job 1, you open files JOB1, and SUBMIT, then read each record from JOB1 and immediately write it to SUBMIT. Finally, you close both files, and by closing SUBMIT you're telling JES to process the job.