Mainframe Path Start learning free
CoreJcl

Compile, bind and run a COBOL program

The three-step pattern, with the options that matter in test.

CLGJOB
//CLGJOB   JOB (ACCT01),'COMPILE LINK GO',CLASS=A,MSGCLASS=X,
//            NOTIFY=&SYSUID,REGION=0M
//* ---------- compile ----------
//COMP     EXEC PGM=IGYCRCTL,
//   PARM='OBJECT,LIST,MAP,XREF,SSRANGE,TEST,TRUNC(BIN)'
//STEPLIB  DD DSN=SYS1.COBOL.SIGYCOMP,DISP=SHR
//SYSIN    DD DSN=DEV.PAY.SOURCE(PAYSUM),DISP=SHR
//SYSLIB   DD DSN=DEV.PAY.COPYLIB,DISP=SHR
//         DD DSN=PROD.COMMON.COPYLIB,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSLIN   DD DSN=&&OBJ,DISP=(NEW,PASS),SPACE=(CYL,(1,1)),
//            DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)
//SYSUT1   DD UNIT=SYSDA,SPACE=(CYL,(2,1))
//* ---------- bind ----------
//BIND     EXEC PGM=IEWL,PARM='LIST,MAP,XREF,RENT',
//            COND=(4,LT,COMP)
//SYSLIN   DD DSN=&&OBJ,DISP=(OLD,DELETE)
//SYSLMOD  DD DSN=DEV.PAY.LOADLIB(PAYSUM),DISP=SHR
//SYSLIB   DD DSN=SYS1.SCEELKED,DISP=SHR
//SYSPRINT DD SYSOUT=*
//* ---------- run ----------
//GO       EXEC PGM=PAYSUM,COND=(4,LT)
//STEPLIB  DD DSN=DEV.PAY.LOADLIB,DISP=SHR
//INFILE   DD DSN=DEV.PAY.TESTDATA,DISP=SHR
//SYSOUT   DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
Compile optionWhy
LIST, MAP, OFFSETProduces the offset map you need to turn an abend offset into a line number
XREFCross-reference of every data name and where it is used
SSRANGERun-time subscript checking — use it in test
TESTDebugging information for a source-level debugger
TRUNC(BIN)Controls binary truncation behaviour; follow the site standard

Stuck on something else?
Ask the community or search the full course.

Ask a question