Prelinking and linking under z/OS batch

Using IBM-supplied cataloged procedures

The IBM-supplied catalog procedures and REXX EXECs use the DLL versions of the IBM-supplied class libraries by default. That is, the IBM-supplied Class Libraries definition side-deck data set, SCLBSID, is included in the SYSIN concatenation.

If you are statically linking the relevant class library object code, you must override the PLKED.SYSLIB concatenation to include the SCLBCPP or SCLBCPP2 data set. The z/OS® V1R2 version of the static library is in CBC.SCLBCPP2.

Note: If your application consists of multiple modules (for example, a main module and a DLL) that use the same class library, make sure that all your modules link dynamically to the class library. Otherwise, the class library will be linked in multiple times, and there will be multiple copies in use by your application. You cannot use multiple copies of a class library within a single application. If you do, you can have unexpected results.
You can use one of the following IBM-supplied cataloged procedures that include a link-edit step to link-edit your z/OS XL C program:
EDCCL
Compile and link-edit
EDCCLG
Compile, link-edit, and run
EDCCPL
Compile, prelink, and link-edit
EDCCPLG
Compile, prelink, link-edit, and run
Note: By default, the procedures EDCCL, EDCCLG, and EDCCPLG do not save the compiled object. EDCCLG and EDCCPLG do not save load modules.
See Cataloged procedures and REXX EXECs for more information on REXX EXECs and their uses.
Example: The following example shows the general job control procedure for link-editing a program under z/OS batch using the Language Environment® Library.
Figure 1. Link-editing a program under z/OS batch
// jobcard
//*
//* THE FOLLOWING STEP LINKS THE MEMBERS TESTFILE AND DECODE FROM
//* THE LIBRARIES USERID.WORK.OBJECT AND USERID.LIBRARY.OBJECT AND
//* PLACES THE LOAD MODULE IN USERID.WORK.LOAD(TEST)
//*
//LKED   EXEC  PGM=IEWL,REGION=1024K,PARM='AMODE=31,RMODE=ANY,MAP'
//SYSLIB   DD  DSNAME=CEE.SCEELKED,DISP=SHR
//SYSLIN   DD  DDNAME=SYSIN
//SYSLMOD  DD  DSNAME=USERID.WORK.LOAD(TEST),DISP=SHR
//OBJECT   DD  DSNAME=USERID.WORK.OBJECT,DISP=SHR
//LIBRARY  DD  DSNAME=USERID.LIBRARY.OBJECT,DISP=SHR
//SYSPRINT DD  SYSOUT=*
//SYSUT1   DD  UNIT=VIO,SPACE=(32000,(30,30))
//SYSIN    DD  DATA,DLM=@@
     INCLUDE   OBJECT(TESTFILE)
     INCLUDE   LIBRARY(DECODE)
@@
You can use one of the following IBM-supplied cataloged procedures that include a prelink and link step to link your C++ program:
CBCCL
Compile, prelink, and link
CBCL
Prelink and link
CBCCLG
Compile, prelink, link, and run
CBCLG
Prelink, link, and run.

Specifying prelinker and link-edit options using cataloged procedures

In the cataloged procedures use the PPARM statement to specify prelinker options and the LPARM statement to specify link-edit options as follows:
PPARM='"prelinker-options"'
LPARM='"link-edit-options"'
where prelinker-options is a list of prelinker options and link-edit-options is a list of link-edit options. Separate link-edit options and prelinker options with commas.