Writing JCL for the link-edit process
You can use cataloged procedures rather than supply all the JCL required for a job step. You can use JCL statements to override the statements of the cataloged procedure to tailor the information provided by the link-edit process.
For a description of the IBM-supplied cataloged procedures that include a link-edit step, see Table 1.
- Invoking with the EXEC statement. Use the EXEC job control statement in your JCL to invoke the binder. The EXEC statement is:
//LKED EXEC PGM=HEWL
- Using the PARM parameter. Use the PARM parameter of the EXEC job control statement to select one or more of the optional facilities provided by the binder. For example, if you want a mapping of the executable program produced by the link-edit process, specify:
//LKED EXEC PGM=HEWL,PARM='MAP'
- Required DD statements. The link-edit process requires three standard data sets. You must define these data sets in DD statements with the ddnames SYSLIN, SYSLMOD, and SYSPRINT. If the linkage editor is being used then an additional data set must be defined with ddname SYSUT1. The required data sets and their characteristics are shown in Table 1.
Table 1. Required data sets used for link-editing ddname Type Function SYSLIN Input Primary input to the link-edit process consists of a sequential data set, members from a PDS or PDSE, or an in-stream data set. The primary input must be composed of one or more separately compiled object modules or link-edit control statements. An executable program cannot be part of the primary input, although it can be introduced by the INCLUDE control statement (see Using the INCLUDE statement). SYSLMOD Output The data set where output (executable program) from the link-edit process is stored. SYSPRINT Output SYSPRINT defines the location for the listing that includes reference tables for the executable program. Output from the link-edit process:- Diagnostic messages
- Informational messages
- Module map
- Cross-reference list
SYSUT1 Utility A data set used by the linkage editor as a temporary workspace (the data set must be on a direct access device). This data set is not required for the binder. - Optional DD statements. If you want to use the automatic call library, you must define a data set using a DD statement with the name SYSLIB. You can also specify additional data sets containing object modules and executable programs as additional input to the link-edit process. These data set names and their characteristics are shown in Table 2.
Table 2. Optional data sets used for link-editing ddname Type Function SYSLIB1 Library Secondary input to the linkage editor consists of object modules or load modules that are included in the executable program from the automatic call library. The automatic call library contains load modules or object modules that are used as secondary input to the linkage editor to resolve external symbols left undefined after all the primary input has been processed. The automatic call library can include: - Libraries that contain object modules, with or without linkage editor control statements
- Libraries that contain executable programs
- The libraries that contain the Language Environment resident routines, such as SCEELKED, SCEELKEX, SCEEOBJ, and SCEECPP (for a description of these data sets see Planning to link-edit and run).
SYSLIB is input to the linkage editor only if the CALL=NO link-edit option is not in effect (see Table 1, in z/OS MVS Program Management: User's Guide and Reference and z/OS MVS Program Management: Advanced Facilities , or in z/OS TSO/E Command Reference for more information). You can also identify secondary input to the linkage editor with the INCLUDE statement.
A routine compiled with a Language Environment-conforming compiler cannot be executed until the appropriate Language Environment resident routines have been linked into the executable program. The Language Environment resident routines are contained in the SCEELKED library; the data set name could be CEE.SCEELKED. If you are unsure where SCEELKED has been installed at your location, contact your system administrator. This data set must be specified in the SYSLIB statement in your JCL.
In the following example, the SYSLIB DD statement is written so that Language Environment resident library routines are included as secondary input into your executable program://SYSLIB DD DSNAME=CEE.SCEELKED,DISP=SHR
User-specified2 Input You can use ddnames to get additional executable programs and object modules. Notes:- 1
- Required for library runtime routines
- 2
- Optional data set
- Examples of link-edit JCL.
A typical sequence of job control statements for link-editing an object module (compiled NOXPLINK) into an executable program is shown in Figure 1. The NAME linkage editor control statement in the figure puts PROGRAM1 in USER.LOADLIB with the member name PROGRAM1.
Figure 1. Creating a non-XPLINK executable program under batch//LKED EXEC PGM=HEWL,PARM='MAP' //SYSPRINT DD SYSOUT=A //SYSLMOD DD DSNAME=USER.LOADLIB,UNIT=SYSDA, // DISP=(NEW,KEEP),SPACE=(CYL,(10,10,1)) //SYSLIB DD DSNAME=CEE.SCEELKED,DISP=SHR //SYSLIN DD DSNAME=USER.OBJLIB(PROGRAM1),DISP=SHR // DD DDNAME=SYSIN //SYSIN DD * NAME PROGRAM1(R) /*
A similar sequence of job control statements for link-editing an XPLINK object module is shown in Figure 2.
Figure 2. Creating an XPLINK executable program under batch//LKEDX EXEC PGM=IEWL,REGION=20M, // PARM='AMODE=31,RENT,DYNAM=DLL,CASE=MIXED,MAP,LIST=NOIMP' //SYSPRINT DD SYSOUT=* //SYSLMOD DD DSNAME=USER.PDSELIB,UNIT=SYSALLDA, // DISP=(NEW,KEEP),SPACE=(TRK,(7,7,1)),DSNTYPE=LIBRARY //SYSLIB DD DSNAME=CEE.SCEEBND2,DISP=SHR //SYSLIN DD DSNAME=USER.OBJLIB(PROGRAM1),DISP=SHR // DD DSNAME=CEE.SCEELIB(CELHS003),DISP=SHR // DD DSNAME=CEE.SCEELIB(CELHS001),DISP=SHR //SYSDEFSD DD DUMMY //SYSIN DD * NAME PROGRAM1(R) /*
- Adding members to a library.
The output from the binder is usually placed in a private program library.
The automatic call library that is used as input to the binder can be a Language Environment library (for example, SCEELKED/SCEELKEX for non-XPLINK applications, and SCEEBND2 for XPLINK applications), a compiler library, a private program library, or a subroutine library.
When you are adding a member to a library, you must specify the member name as follows:- When a single module is produced as output from the linkage editor, the member name can be specified as part of the data set name in the SYSLMOD.
- When more than one module is produced as output from the linkage editor, the member name for each module must be specified in the NAME option or the NAME control statement. The member name cannot be specified as part of the data set name.
- Link-editing multiple object modules.
When an Enterprise PL/I for z/OS or PL/I for MVS & VM main procedure is link-edited with other object modules produced by the Enterprise PL/I for z/OS or the PL/I for MVS & VM compilers, the entry point of the resulting executable program is resolved to the external symbol CEESTART. This happens automatically because the CEESTART CSECT is generated first in the object module and is specified in the END statement of the object module. Runtime errors occur if the executable program entry point is forced to some other symbol by use of the linkage editor ENTRY control statement.
If an Enterprise PL/I for z/OS or PL/I for MVS & VM main procedure is link-edited with object modules produced by other language compilers or by assembler, and is the first module to receive control, the user must ensure that the entry point of the resulting executable program is resolved to the external symbol CEESTART. This happens automatically if the Enterprise PL/I for z/OS or PL/I for MVS & VM main procedure is first in the input to the linkage editor. Runtime errors occur if the executable program entry point is forced to some other symbol by use of the linkage editor ENTRY control statement.
Alternatively, the following linkage editor ENTRY control statement can be included in the input to the linkage editor:ENTRY CEESTART