Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 4: CICS COBOL Programming


CICS Compile and Link

The compile and link for a CICS program is a three-step batch job: translate, compile, then link-edit. Below is a complete sample JCL you can adapt, followed by notes on the DD statements that cause the most trouble.

The three JCL steps

  • TRN - EXEC PGM=DFHECP1$: the CICS translator. STEPLIB must point to the CICS load library (SDFHLOAD).
  • COB - EXEC PGM=IGYCRCTL: the Enterprise COBOL compiler. It compiles the translator's output, not your original source.
  • LKED - EXEC PGM=IEWL: the linkage editor. It creates the load module in the CICS load library.
  • COND parameters stop later steps when an earlier step fails.

DD statements to get right

  • SYSIN on the TRN step: your COBOL source member containing the EXEC CICS statements.
  • SYSPUNCH on the TRN step: the translated source, passed to the compiler with DISP=(,PASS).
  • SYSIN on the COB step: the translator's output dataset.
  • SYSLIB on the COB step: your copybook library (for COPY members like DFHAID).
  • SYSLMOD on the LKED step: the CICS load library that is in the region's DFHRPL.
  • SYSIN on the LKED step: a NAME card with the program name, usually matching the PROGRAM-ID.

Sample JCL

//CICSCMP  JOB (ACCT),'BUILD CICS PGM',CLASS=A
//TRN     EXEC PGM=DFHECP1$,PARM='COBOL3'
//STEPLIB  DD  DSN=CICS.SDFHLOAD,DISP=SHR
//SYSIN    DD  DSN=MYID.CICS.SOURCE(HELLO),DISP=SHR
//SYSPRINT DD  SYSOUT=*
//SYSPUNCH DD  DSN=&&TRNSRC,DISP=(,PASS),UNIT=SYSDA,
//            SPACE=(TRK,(20,20)),
//            DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)
//COB     EXEC PGM=IGYCRCTL,COND=(0,NE,TRN),PARM='LIB'
//STEPLIB  DD  DSN=IGY.SIGYCOMP,DISP=SHR
//SYSIN    DD  DSN=&&TRNSRC,DISP=(OLD,DELETE)
//SYSLIB   DD  DSN=MYID.CICS.COPYLIB,DISP=SHR
//SYSPRINT DD  SYSOUT=*
//SYSUT1   DD  UNIT=SYSDA,SPACE=(CYL,(2,2))
//SYSUT2   DD  UNIT=SYSDA,SPACE=(CYL,(2,2))
//SYSUT3   DD  UNIT=SYSDA,SPACE=(CYL,(2,2))
//SYSUT4   DD  UNIT=SYSDA,SPACE=(CYL,(2,2))
//SYSLIN   DD  DSN=&&OBJ,DISP=(,PASS),UNIT=SYSDA,
//            SPACE=(TRK,(20,20)),
//            DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)
//LKED    EXEC PGM=IEWL,PARM='LIST,XREF',
//            COND=((0,NE,TRN),(0,NE,COB))
//SYSLIN   DD  DSN=&&OBJ,DISP=(OLD,DELETE)
//          DD  DDNAME=SYSIN
//SYSLMOD  DD  DSN=CICS.USERLOAD,DISP=SHR
//SYSUT1   DD  UNIT=SYSDA,SPACE=(CYL,(2,2))
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  *
  NAME HELLO(R)
/*





© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant