The program needs to be compiled, and a load module is created with all the sub-programs for the execution of the COBOL program in the batch mood. The JCL uses the load module instead of the actual program at the time of execution. The load libraries are patched and given to the JCL at the time of execution using JCLLIB or STEPLIB.
Below I am mentioning a JCL example in which the program MYPROG is executed using the input file MYDATA.URMI.INPUT. This program will produce two output files written to the spool.
//COBBSTEP JOB CLASS=6,NOTIFY=&SYSUID
//
//STEP10 EXEC PGM=MYPROG,PARM=ACCT5000
//STEPLIB DD DSN=MYDATA.URMI.LOADLIB,DISP=SHR
//INPUT1 DD DSN=MYDATA.URMI.INPUT,DISP=SHR
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//SYSIN DD *
//CUST1 1000
//CUST2 1001
/*