Sample RUN JCL for COBOL Program
Sample RUN JCL for a COBOL Program – In Mainframes area any batch COBOL program needs to have its corresponding JCL to run it without which it can not be executed. As we know JCL is a JOb Control Language which is used to run and control the execution of the programs. So JOB written in JCL is must to execute any batch COBOL program, The job used to run it is called a RUN JCL. Below example shows a sample Run JCL for a program named ‘CUSTR001’. CUSTR001 is developed to have one input file and it generates one output file using the input file records. As it uses two files, these files should also be be specified in the RUn JCL.
----+----1----+----2----+----3----+----4----+----5----+----6----+----7-- //CUSTJB01 JOB (990A5,'25/06/19',ACNTCR),'MAHENDER',MSGCLASS=D, // CLASS=A,TIME=10,NOTIFY=&SYSUID //***************************************************************** //* JOB TO RUN THE PGM CUSTR001 //*************************************************************** //STEP01 EXEC PGM=CUSTR001 //STEPLIB DD DSN=CUST.PR.LOADLIB,DISP=SHR //CUSTIN DD DSN=CUST.FL.EXT.IN01,DISP=SHR //CUSTOUT DD DSN=CUST.FL.EXT.RPT01,UNIT=SYSDA, // DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(1,1),RLSE), // DCB=(RECFM=FB,LRECL=40,BLKSIZE=0) //SYSPRINT DD SYSOUT=* //SYSOUT DD SYSOUT=A //
First two line of the JOB are called JOB card and more information on the job card can be found at JCL JOB Card
Notes:
- CUSTJB01 –> This is the JOB name, It can be be any name but should be limited to 8 char length.
- JOB –> It is a Keyword parameter and is must to specify.
- STEP01 –> This is the STEP Name which can be any name like CUST01, RPT01 etc. The point here is, no need to include the word STEP in the stepname. There can be many steps in a JOB and each step can execute a Program.
- EXEC PGM –> This is the place where the program that needs to executed should be given.
- STEPLIB –> Here load Libraries should be specified, It can be one or more than one. If more than one load libraries are specified, then the OS searches all the specified load libraries in the order they are given and Once it finds in one of them it stops searching for it further.
- CUSTIN –> This is the input file. Relationship between COBOL file and this JCL file is established in the COBOL FILE CONTROL area.
- CUSTOUT –> Output file name. As it is a New file, it should be specified with DISP, SPACE and DCB details.
- SYSPRINT and SYSOUT are used to display the messages that gets generated while running.
Hi, just found your very interesting web/blog.
I’m trying to run a COBOL program who shows an ISPF panel. In COBOL seems to be not easy as with REXX .
In general what is the right procedure to call ISPFs services from a COBOL program?
As I understand, first I will create a JCL compiler+linker with definition of the libraries needed (someones are already in the system -TSO LISTA-) but other should be indicated in STEPLIB? If yes how?
Then in COBOL a CALL ISPLINK… ?
Then the next is to run this COBOL program with TSO CALL or within a REXX script? Any example?
Or I should run the COBOL in batch with a JCL script?
Thank you
Higinio
Hi Higinio..
Thanks for browsing thru my blog. I never worked on ISPLINK that you were referring But I found a PDF that might be helpful . Please go thru that once.
https://www-01.ibm.com/servers/resourcelink/svc00100.nsf/pages/zOSV2R3SC193626/$file/f54sg00_v2r3.pdf
Thanks,
Mahender Reddy
Hi,
Very good blog you have here!
I’m learning mainframe Enterprise COBOL with the IBM MTM2019 challenge.
By any chance have you a full example on how to use ISPF services (mainly how to show a panel) with COBOL and the correct JCL to compile/link and how to run (batch and interactive).
I ask you that because with REXX is very easy, but with COBOL and the CALL ISPLINK functions I’m lost!
Thank you
Higinio
please write compile jcl for cobol program