Prelinking and linking all object modules
If you are using C++, or if you have compiled your C source with the RENT compile-time option, you must prelink all of the object modules together. The prelinker accepts one or more object modules, combines them, and generates a single output object module which can then be linked. For more information, see z/OS XL C/C++ User's Guide.
When prelinking for CICS, you should expect some unresolved external references and a return code of 4. These unresolved references should be resolved at link time.
CICS provides a stub called DFHELII, which must be link-edited with the load module. For your convenience, the linkage editor commands required for CICS are provided with CICS in the DFHEILID member of the SDFHC370 data set. The DFHEILID member must be reblocked before it is passed to the linkage editor. A name card should also be passed to the linkage editor. All applications must run AMODE=31. It is recommended that the object module is linked with AMODE(31) and RMODE(ANY). CICS does not require any other linkage editor options.
If you are using C, and your program will reside in one of the DFHRPL libraries, you do not need to link-edit the module with the RENT option. However, if the program is to be installed in one of the link pack areas, STEPLIBs, or data sets in the system link list, you should link-edit the module with the RENT option.
Figure 1 shows an example of how to prelink and link C and C++ modules.
//*--------------------------------------------------------------------
//* Reblock CICS support link module
//*--------------------------------------------------------------------
//COPYLINK EXEC PGM=IEBGENER
//SYSUT1 DD DSN=CICS.V4R1M0.SDFHC370(DFHEILID),DISP=SHR
//SYSUT2 DD DSN=&©LINK,DISP=(,PASS),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200),
// UNIT=VIO,SPACE=(400,(20,20))
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//*---------------------------------------------------------------------
//* Prelink and link MYMAIN with MYCICSTF and MYOTHSTF
//*---------------------------------------------------------------------
//P0010598 EXEC EDCPL,
// INFILE='MYID.OBJECT(MYMAIN)',
// OUTFILE='MYID.CICS.LOAD(MYMAIN),DISP=SHR',
// PPARM=' NCAL',
// LPARM='AMODE(31),RMODE(ANY) ',
// SYSOUT4='*'
//PLKED.SYSIN DD DATA,DLM='/>'
INCLUDE OBJECT(MYMAIN)
INCLUDE OBJECT(MYCICSTF)
INCLUDE OBJECT(MYOTHSTF)
/>
//PLKED.SYSMOD DD DSN=&&PLNK,DISP=(,PASS),UNIT=VIO,
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200),
// SPACE=(32000,(30,30))
//PLKED.OBJECT DD DSN=MYID.OBJECT,DISP=SHR
//LKED.SYSLIB DD DSN=CICS.V4R1M0.SDFHLOAD,DISP=SHR
// DD DSN=CEE.SCEELKED,DISP=SHR
//LKED.SYSLIN DD DSN=&©LINK,DISP=(SHR,DELETE)
// DD DSN=*.PLKED.SYSMOD,DISP=(SHR,DELETE)
// DD DDNAME=SYSIN
//LKED.SYSLMOD DD DSN=MYID.CICS.LOAD,DISP=SHR
//LKED.SYSIN DD DATA,DLM='/>'
NAME MYMAIN(R)
/>