Let us code a simple COBOL HELLO WORLD Program
Step1: Code the COBOL Program
Step2: Prepare the COMPILE JCL to compile and Link Edit the COBOL Program
Step3: Prepare the RUN JCL to execute the COBOL Program
Step 1 - Simple HELLO COBOL WORLD Program
Copy this HELLO WORLD COBOL Program
IDENTIFICATION DIVISION. PROGRAM-ID. HELLOWRD. PROCEDURE DIVISION. DISPLAY "SIMPLE HELLO WORLD". STOP RUN.
Step 2 - JCL Compile - To Compile the COBOL Program
Note/warning/suggestion/improvement:
TutorialBrain is providing 2 types of compile JCL because most of the organization has their own customized COMPILE as per their requirement. You can choose which one works for you.
compiling- First form of JCL
//MATEKSD JOB MSGLEVEL=(1,1),NOTIFY=&SYSUID //* //* COMPILE A COBOL PROGRAM //* //CL EXEC COBOLCL, // COPYLIB=MATEKS.COPYLIB, <= COPYBOOK LIBRARY // LOADLIB=MATEKS.LOADLIB, <= LOAD LIBRARY // SRCLIB=MATEKS.COBOL.SRCLIB, <= SOURCE LIBRARY // MEMBER=COB001 <= SOURCE MEMBER
compiling- The Second form of JCL
//COMPJCL JOB 1AD40G12,'COMPCOB-COMPLINK',NOTIFY=&SYSUID //************************************************************* //*COMPILAR Y LINKEDITAR //************************************************************* //STEP0 EXEC IGYWCL,PARM.COBOL='LIB,APOST,XREF,MAP,OFFSET' //* ----------------------------------------------------------- //* JCL PARA COMPILAR PGM DE COBOL (SIN DB2 Y SIN CICS) //* ----------------------------------------------------------- //* ----------------------------------------------------------- //COBOL.SYSLIB DD DISP=SHR,DSN=MATEKS.COBOL.COPYLIB //COBOL.SYSIN DD DISP=SHR,DSN=MATEKS.COBOL.SRCLIB(COB001) //LKED.SYSLMOD DD DISP=OLD,DSN=MATEKS.COBOL.LOADLIB(COB001) /* //
Step 3 - Run JCL - To Run(Execute) the COBOL program)
Run JCL
//MATEKSD JOB MSGLEVEL=(1,1),NOTIFY=&SYSUID //* //* RUN A COBOL PROGRAM, //* //STEP01 EXEC PGM=COB001 //STEPLIB DD DSN=MATEKS.LOADLIB,DISP=SHR //SYSOUT DD SYSOUT=*
Note/Info The compile JCL and RUN JCL is provided to you by your Mainframe Admin in your company and it might differ from company to company so the above compile JCL might not work for you. In that case, you need to ask your mainframe admin to share both COMPILE and RUN JCL.