submitting a jcl using cobol
submitting a jcl using cobol can be done through a facility called internal reader
here is the example
cobol program
000100 ID DIVISION.
000200 PROGRAM-ID. JCLCOB.
000300 ENVIRONMENT DIVISION.
000400 INPUT-OUTPUT SECTION.
000500 FILE-CONTROL.
000600 SELECT INFILE ASSIGN TO DD1
000610 ORGANIZATION IS SEQUENTIAL
000620 ACCESS MODE IS SEQUENTIAL
000700 FILE STATUS IS FST.
000800 DATA DIVISION.
000900 FILE SECTION.
001000 FD INFILE.
001100 01 INREC PIC X(80).
001200 WORKING-STORAGE SECTION.
001300 01 FST PIC X(2).
001400 PROCEDURE DIVISION.
001500 OPEN OUTPUT INFILE.
001600 DISPLAY FST.
001700 MOVE '//UNNI JOB NOTIFY=&SYSUID' TO INREC.
001800 WRITE INREC.
001900 MOVE '//STEP1 EXEC PGM=IEFBR14' TO INREC.
002000 WRITE INREC.
002100 MOVE '//DD1 DD DSN=ESCUB07.UNNI.ALEX,' TO INREC.
002200 WRITE INREC.
002300 MOVE '// DISP=(NEW,CATLG,DELETE),' TO INREC.
002400 WRITE INREC.
002410 MOVE '// DCB=(LRECL=80,BLKSIZE=800,RECFM=FB,DSORG=PO),'
002420 TO INREC.
002430 WRITE INREC.
002500 MOVE '// SPACE=(TRK,(1,2),RLSE)' TO INREC.
002600 WRITE INREC.
002700 MOVE '//SYSPRINT DD SYSOUT=*' TO INREC.
002800 WRITE INREC.
002900 MOVE '//SYSIN DD DUMMY' TO INREC.
003000 WRITE INREC.
003100 MOVE '//' TO INREC.
003200 WRITE INREC.
003300 DISPLAY FST.
003400 CLOSE INFILE.
003500 STOP RUN.
use the jcl to submit this cobol as
000100 //UNNIK JOB NOTIFY=&SYSUID
000200 //STEP1 EXEC PGM=JCLCOB
000300 //STEPLIB DD DSN=ESCUB07.UNNI.LOAD,DISP=SHR
000400 //DD1 DD SYSOUT=(*,INTRDR)
000500 //