How do you submit JCL via a Cobol program?

Answers were Sorted based on User's Feedback



How do you submit JCL via a Cobol program?..

Answer / abhinandan

Below is explanation with example:-

THE BELOW GIVEN IS AN EXAMPLE OF HOW TO SUBMIT A JCL FROM A
COBOL PGM:
============================================================
============

COBOL CODE WHICH HAS THE JCL STATEMENTS:
=========================================

IDENTIFICATION DIVISION.
PROGRAM-ID. PROG55.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT IN-FILE ASSIGN DDFILE1
ORGANIZATION IS SEQUENTIAL
FILE STATUS IS IN-STATUS.
DATA DIVISION.
FILE SECTION.
FD IN-FILE.
01 IN-REC PIC X(80).
WORKING-STORAGE SECTION.
01 IN-STATUS PIC X(2).
PROCEDURE DIVISION.

OPEN OUTPUT IN-FILE.
DISPLAY IN-STATUS.

MOVE '//SORT002 JOB MSGCLASS=X,CLASS=T,' TO IN-
REC.
WRITE IN-REC.

MOVE '// MSGLEVEL=(1,1),NOTIFY=XXXXX'
TO IN-
REC.
WRITE IN-REC.

MOVE '//STEPDEF EXEC PGM=IEFBR14' TO IN-
REC.
WRITE IN-REC.

MOVE '//DATA1 DD DSN=TNL.PV.INTRDR.SAMF,DISP=
(NEW,CATLG),'
TO IN-
REC.
WRITE IN-REC.
MOVE '// LRECL=80' TO IN-
REC

WRITE IN-REC.

DISPLAY IN-STATUS.
CLOSE IN-FILE.
STOP RUN.


THIS IS THE JCL TO RUN THE ABOVE COBOL PGM 'PROG55' FROM
ENDEVOR LIBRARY.

Note: '//DDFILE1 DD SYSOUT=(*,INTRDR)' USED BELOW.

ALSO THE DDFILE1 IS USED AS THE DD NAME IN THE ABOVE COBOL
PGM
============================================================
===============

EDIT ,xxxxx.GENERAL.JCL(INTR1) - 01.03
******,***************************** Top of Data
******************************
000001,//XXXXX98 JOB CLASS=A,
000002,// MSGCLASS=X,TIME=NOLIMIT,
000003,// NOTIFY=&SYSUID,
000004,// MSGLEVEL=(1,1)
000005,//STEP0010 EXEC PGM=PROG55
000006,//DDFILE1 DD SYSOUT=(*,INTRDR)
000007,//SYSPRINT DD SYSOUT=*
000008,//SYSUDUMP DD SYSOUT=*
000009,//STEPLIB DD DSN=PMI.CR.SUPT.LOADLIB,DISP=SHR
000010,//SYSIN DD DUMMY
******,**************************** Bottom of Data
****************************



THIS IS THE JOB THAT IS CREATED & SUBMITTED BY THE COBOL
PGM:
============================================================
===

SYSVIEW ISPF1 RCEM --------------,Job Queues,-------
26Jan08 11:08:50
,* ,ALL, ,ALL ,ALL ,
Cmd Jobname Type Jobnr Queue Stat|
CCode
,SORT002 JOB 93409 OUTP
HLDC,..................... 0,
********************************* End of Data
*********************************



THIS NEW JCL CONTAINS THE BELOW GIVEN JCL STATEMENTS:
======================================================

******,***************************** Top of Data
******************************
000001,//SORT002 JOB MSGCLASS=X,CLASS=T,
000002,// MSGLEVEL=(1,1),NOTIFY=XXXXX
000003,//* $ACFJ219 ACF2 ACTIVE RCEMP1
000004,//STEPDEF EXEC PGM=IEFBR14
000005,//DATA1 DD DSN=TNL.PV.INTRDR.SAMF,DISP=(NEW,CATLG),
000006,// LRECL=80
******,**************************** Bottom of Data
****************************

Is This Answer Correct ?    18 Yes 3 No

How do you submit JCL via a Cobol program?..

Answer / guest

In your JCL define as //JOBA JOB 1111, JOB1 //STEP01 EXEC
PGM=PROG1 //ddname DD SYSOUT=(*,INTRDR)....and your
COBOL(PROG should look like this SELECT JCL-FILE ASSIGN TO
ddname. Open this file and write the JCL statements into
this file. E.g. MOVE '//TESTJOB JOB 1111,VISVEISH' TO
JCL-REC.MOVE '//STEP01 EXEC PGM=IEFBR14' TO JCL- REC and
close this file. Then TESTJOB will be submitted.

Is This Answer Correct ?    14 Yes 0 No

Post New Answer

More JCL Interview Questions

Hi Please try to be to-the-point. 1) How to INCLUDE a JCL segment in a JOB ? (A Small example) 2) What is SPOOL and what is SPOOL FULL ? and how to direct the output of a Jobstep to SPOOL ?

3 Answers   IBM,


Explain the function of dd name parameter with a 2 part structure; audit.report?

0 Answers  


how can we merge two input files from two different jobs into one output file ? Please ans any one ASAP?

1 Answers  


What is the difference between IEBGENER, IEBCOPY and REPRO in IDCAMS utility?

8 Answers   Accenture, TCS,


1) SORT FIELDS=(20,4,CH,D,10,3,CH,D) OUTREC FIELDS=(7:20,4,C' FUTURE ',20,2,10,3,1Z,1,9,13,7, 24,57,TRAN=LTOU,6X'FF') This example illustrates how a fixed-length input data set can be sorted and reformatted for output. The SORTIN LRECL is 80 bytes. The reformatted output records are fixed length with a record size of 103 bytes. SOLRF (the IBM-supplied default) is in effect, so unless the SORTOUT LRECL is specified or available, it will automatically be set to the reformatted record length of 103. in the above example i have some doubts that a) sort fields=(20,4,CH,D,10,3,CH,D) -what exactly it does and this fields related to output record fields or input record fields b)outrec used to refprmat the records after sorting that means could please reply me as soon as possible Thanks. Venkat

1 Answers   Tesco,






What is the use of symbol // in jcl?

0 Answers  


I HAVE A VB BLOCK WHICH IS USED AS INPUT IN COBOL CONATINING SOME RECORDS CAN I CHANGE THE FILE FROM VB TO FB?

0 Answers  


Describe the EXEC statement, its meaning, syntax and keywords?

2 Answers  


If I update one or more members in a pds in the step 1, how can I reach these new contents to be used in the step 2 of the same job? To start a new job via intrdr is not satisfactory, because I must solve this problem in one job.

2 Answers   IBM,


what are the various stages of job processing?

0 Answers   IBM,


what is the purpose of coding class parameter in job statement?

0 Answers   IBM,


can we give instream data in procedure

6 Answers   EDS,


Categories