How to submit a JCL from Cobol program?

Showing Answers 1 - 12 of 12 Answers

lfrank

  • Jan 8th, 2008
 

I've done this many times. Set up the JCL statements in Working-Storage as you want them to be presented to the operating system. Create an FD for an output data set with a fixed, 80-character format and write the statements to this file.

In the JCL, include a DD statement directed to the JES internal reader.

     SELECT JCLOUT-FILE ASSIGN TO JCLOUT.
    *                                             
     FD  JCLOUT-FILE                              
         RECORD CONTAINS 80 CHARACTERS            
         BLOCK CONTAINS 0 RECORDS                 
         RECORDING MODE IS F                      
         LABEL RECORDS ARE STANDARD.              
     01  JCLOUT-RECORD                   PIC X(80).
    *                                             
    *                                                            
     01  JCL-01.                                                 
         05              PIC XX    VALUE '//'.                   
         05  J1-SYSUID   PIC X(7)  VALUE SPACES.                 
         05              PIC X(21) VALUE 'M JOB (Z00000,F11B),'''.
         05  J1-REGION   PIC X(20) VALUE '........ CSD-GCD '','. 
         05              PIC X(31) VALUE SPACES.                 
    *                                                            
     01  JCL-02.   
         ... additional JCL statements

    *
    *
    *                                  
     0040-WRITE-JCL.                   
         WRITE JCLOUT-RECORD FROM JCL-01
         WRITE JCLOUT-RECORD FROM JCL-02
         WRITE JCLOUT-RECORD FROM JCL-03
         WRITE JCLOUT-RECORD FROM JCL-04
         WRITE JCLOUT-RECORD FROM JCL-05
         WRITE JCLOUT-RECORD FROM JCL-06

The DD statement for this example would be:
     //JCLOUT   DD SYSOUT=(A,INTRDR)

                                              



  Was this answer useful?  Yes

dashing

  • Mar 8th, 2009
 

Create a file and move the statements of JCL to the record layout and in the run
JCL, DD statement specify,
//ddname dd sysout=(*,intrdr)
and it will submit the COBOL program.

  Was this answer useful?  Yes

senthil.ads

  • Apr 29th, 2009
 

Let us the program is TEST and JCL you want to submit from program is A.B.C(MEM).

//STEP1    EXEC  PGM=TEST
//INPUT    DD      DSN=A.B.C(MEM)
//SUB       DD      SYSOUT=(*,INTRDR)


In the program define these two file (Both should have a LRECL of 80). Read the input record from A.B.C(MEM) ono by one (JCL STATEMENTS) and  write into SUB file.

When you close the SUB file (After copying all the JCL from A.B.C(MEM)), the job will be submitted to JES automatically.

  Was this answer useful?  Yes

tag_tushar

  • Oct 6th, 2010
 

Name of Jcl to be submitted by COBOL program: ABC.XYZ.JCL1

COBOL program Name: JCLCOB

ID DIVISION.
PROGRAM-ID. 'JCL-COBOL'.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT INFILE ASSIGN TO DD1
FILE STATUS IS JC.
DATA DIVISION.
FILE SECTION.
FD INFILE.
01 INREC.
02 INP PIC X(80).
WORKING-STORAGE SECTION.
01 JC PIC X(2).
PROCEDURE DIVISION.
OPEN EXTEND INFILE.
MOVE "//JOB1 JOB NOTIFY &SYSUID PRTY 15" TO INP.
WRITE INREC.
MOVE "//STEP1 EXEC PGM IEFBR14" TO INP.
WRITE INREC.
MOVE "//SYSPRINT DD SYSOUT *" TO INP.
WRITE INREC.
MOVE "//DD1 DD DSN ABC.XYZ.JCL1 DISP SHR" TO INP.
WRITE INREC.
MOVE "//DD2 DD SYSOUT (* INTRDR)" TO INP.
WRITE INREC.
MOVE "//SYSIN DD DUMMY" TO INP.
WRITE INREC.
CLOSE INFILE.
STOP RUN.

COBOBL compiler & link-eiditor:
//JOB1 JOB NOTIFYT &SYSUID PRTY 15
//CLER JCLLIB ORDER XXX.XXX.XXX <----REPLACE THIS BY YOUR SYSTEM LIBRARY
//COMILE.SYSIN DD DSN ABC.XYZ.COBOL(JCLCOB) DISP SHR
//LKED.SYSLMOD DD DSN ABC.XYZ.LOADLIB(JCLCOB) DISP SHR
/*
This will create the load module named (JCLCOB)

Now after compiling & link-editing process submit this Jcl to execute the COBOL porgram:
// JOB1 JOB NOTIFY &SYSUID PRTY 15
//RUN EXEC PGM JCLCOB
//STEPLIB DD DSN ABC.XYZ.LOADLIB DISP SHR
//SYSPRINT DD SYSOUT *
//DD1 DD SYSOUT (* INTRDR)
//SYSIN DD DUMMY
/*
Upon submition of the above program ABC.XYZ.JCL1 will be executed.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions