Code: |
//LKED EXEC PGM=IEWL,PARM='XREF', // COND=(4,LT,COB) //SYSLIB DD DISP=SHR,DSN=COBOL.V2R1M0.SIGYCOMP // DD DISP=SHR,DSN=CEE.SCEELKED //SYSLIN DD DSN=&&COBOUT,DISP=(OLD,DELETE) //SYSLMOD DD DSN=ZDVB.SMS.BAT.LOADLIB(&MEMBER), // DISP=SHR //SYSPRINT DD SYSOUT=* //SYSUDUMP DD SYSOUT=* //SYSUT1 DD SPACE=(1024,(50,50)),UNIT=SYSDA //sysin dd include xxxlib(member) |
Code: |
The Linkage Editor The linkage editor (PGM=IEWL) is used to create an executable load module from an object deck. The linkage editor must be used to make an executable copy of a compiled or assembled program. External symbols in the object module(s), optional linkage editor control statements, and linkage editor JCL parameters determine how the finished load module is to be constructed. NOTE: If your installation has DFSMS/MVS installed, the linkage editor at your site is called the "binder" and is part of the MVS Program Management Services component. The terms "binder" and "linkage editor" can be used interchangeably when reading the information below. The binder supports all of the functions of the linkage editor, and also supports linking of "program objects" and PDSE data sets. Program objects reside in PDSE data sets and are page-mapped in virtual storage; many of the restrictions that applied to the size of load modules do not apply to program objects. Sample JCL for the linkage editor appears below; following the JCL is a discussion of each DD statement required by the linkage editor and what each is used for. An explanation of linkage editor control statements follows the JCL discussion, and linkage editor usage examples appear at the end of this reference item. Sample linkage editor JCL: //JS10 EXEC PGM=IEWL,REGION=1024K, // PARM='parms...' Parameters (optional) //SYSPRINT DD SYSOUT=* Output Messages //SYSTERM DD SYSOUT=* Output Messages (optional) //SYSLIN DD DSN=...,DISP=SHR Input Object Module File // DD DDNAME=SYSIN (Points to optional input) //SYSLMOD DD DSN=...,DISP=SHR Output Load Module File //SYSLIB DD DSN=...,DISP=SHR Optional 'Auto-call' Library //anydd DD DSN=...,DISP=SHR Optional input library //SYSUT1 DD UNIT=SYSDA,SPACE=(TRK,(30)) Required work file //SYSIN DD * Control Statements (optional) control statements... /* Explanation of Linkage Editor JCL: EXEC: PGM=HEWL or LINKEDIT can also be specified. PARM: The optional PARM field is used to pass different processing options. Possible PARM= values are described below under control statement descriptions. Possible PARM field options are listed here. For load module attributes: AC=n - Sets authorization code (1 if APF authorized) DC - Sets downward compatible attribute by forcing a maximum output blocksize of 1024 bytes SCTR - Indicates "scatter" load module format NE - Sets "not editable" attribute - module can't be relinked OL - Sets "only loadable" attribute OVLY - Sets "overlay" attribute RENT - Sets "reentrant" attribute if all CSECTS are marked reentrant REUS - Sets "serially reusable" attribute if all CSECTS are marked serially reusable REFR - Sets "refreshable" attribute if all CSECTS are marked refreshable AMODE=31|24|ANY - Sets addressing mode of load module(s) RMODE=24 or ANY - Sets residency mode of load module(s) TEST - TSO TEST command symbol tables are accepted as input and are placed in the output module For linkage editor execution options: DCBS - When specified, allows the SYSLMOD DD statement to specify DCB= LIST - Produces a control card listing LET | NOLET - Produce or don't produce executable module if missing references MAP | NOMAP - Do or don't produce load module map XREF - Produce load module cross reference map NCAL - Don't search SYSLIB to resolve missing external references XCAL - Allows valid exclusive calls not to be considered an error and thus the load module marked executable PRINT | NOPRINT - Do or don't print messages to SYSLOUT DD TERM - Write error messages to SYSTERM DD statement SIZE=(v1,v2) - Specifies size of region and buffer used for load module formatting. 'v1' is region size to use, 'v2' is buffer size. Default for 'v1' is 256K, default for 'v2' is 48K. Optimum value for 'v2' is 2 times SYSLMOD block size SYSPRINT DD : The SYSPRINT DD statement is required and must have RECFM=FBA or RECFM=FB. The BLKSIZE value can be any value up to 32670 that is a multiple of 121. Linkage editor messages are written to this file. SYSLIN DD : The SYSLIN DD statement is required and contains the input for the linkage editor. The input can be object modules output from a compiler, or load modules from the linkage editor, or both. The SYSLIN file must be a sequential file or a PDS member. Linkage editor control statements can appear anywhere in the SYSLIN input. The SYSLIN input can also consist of just control statements. SYSLIB DD : The SYSLIB DD statement is optional and points to the 'auto- call' library. The library must be a PDS that contains either object modules or load modules but not both. More than one PDS can be concatenated together. External references are searched for in SYSLIB unless the NCAL JCL parm is specified. External references are resolved from the SYSLIB library if they exist as a member or alias in the library and are marked as an external symbol in the external symbol dictionary (ESD) of the member found. SYSLMOD DD: The SYSLMOD DD statement is required and points to the output file which is to contain the load modules being built by the linkage editor. The SYSLMOD file must be a PDS member or a PDS. RECFM=U is forced by the linkage editor. anydd DD: Additional DD statements with any ddname can also be added to the linkage editor JCL. These DD statements point to files that will be processed by INCLUDE control statements. Valid control statements for the linkage editor are ALIAS, CHANGE, ENTRY, EXPAND, IDENTIFY, INCLUDE, INSERT, LIBRARY, MODE, NAME, ORDER, OVERLAY, PAGE, REPLACE, SETCODE, and SETSSI. Control statement operands can appear anywhere between columns 2 through 72. Control statements are continued by ending the continued statement with a comma, placing a non-blank character in column 72, and continuing the statement beginning in column 16 on the next statement. The syntax and usage of each is discussed below: ALIAS: The ALIAS statement is used to assign an alias for a load module. Up to 64 aliases can be set for a load module and on one ALIAS statement. The aliases being assigned are applicable to the load module that will be named by the next NAME statement in the input stream. The format of the ALIAS control statement is: ALIAS {external name | symbol }{,external name | symbol}... CHANGE: The CHANGE statement is used to change an entry point name, an external name, or a CSECT name in a load module to a new value. Several such changes can be performed on one CHANGE statement. The CHANGE statement affects the module that is next input, either via SYSLIN directly or because of an INCLUDE statement. The format of the CHANGE control statement is: CHANGE external-name(newname){,external-name(newname)}... ENTRY: The ENTRY statement assigns the main entry point for a load module. The main entry point is the first instruction that will be executed when the module is invoked. The entry point being assigned is applicable to the load module that will be named by the next NAME statement in the input stream. The format of the ENTRY control statement is: ENTRY entry-name 'entry-name' has to be a CSECT or an external entry point in the module itself. EXPAND: The EXPAND statement causes the linkage editor to add extra binary zero bytes to one or more CSECTS in a load module. The number of bytes indicated on the EXPAND statement are added at the end of the CSECT named by the EXPAND statement. The format of the EXPAND control statement is: EXPAND csect-name(nnnn){,csect-name(nnnn)}... 'nnnn' is a decimal number indicating the number of bytes to add. IDENTIFY: The IDENTIFY statement allows you to add up to 40 characters of identification information to the identification (IDR) record for the CSECT(s) named on the IDENTIFY statement. The format of the IDENTIFY control statement is: IDENTIFY csect-name('data-value'){,csect-name('data-value')}... Any 1 to 40 EBCDIC characters make up 'data-value'. A null value is represented by a single blank. INCLUDE: The INCLUDE statement makes the linkage editor read additional sequential files or PDS members. INCLUDE statements are used to build a composite load module or modules from several different component modules in one or several libraries. INCLUDE statements are used in the same order that they are encountered in the input stream. The format of the INCLUDE control statement is: INCLUDE ddname{(mem1)},{ddname{(mem1,mem2,mem3)}... 'ddname' is the DD name of a JCL statement in the current job step. 'memname' is the optional name of a PDS member that resides in the PDS allocated to 'ddname'. INSERT: The INSERT statement makes the linkage editor move a CSECT from where it is in the input stream to a segment in an overlay structure. INSERT statements for CSECT to be placed in the root segment should come before all OVERLAY statements. INSERT statements for other segments must follow the OVERLAY statement that names the segment the CSECT is to be inserted into. The format of the INSERT control statement is: INSERT csect1 LIBRARY: The LIBRARY control statement is used to identify libraries in addition to SYSLIB that are to be searched when resolving external references. LIBRARY is also used to prevent a external reference from being resolved during the current linkage editor job step, or during any linkage editor job step. The format of the LIBRARY control statement is: LIBRARY {ddname(memname,memname,...)},(ext-name),*(ext-name) 'ddname' is the DD name of a PDS that is to searched when resolving external references; (memname,memname,...) lists the members to be searched. '(ext-name)' identifies an external reference that is not to be resolved during this linkage editor step, and '*(ext-name)' identifies an external reference that is never to be resolved. The LET parm should be specified when LIBRARY is used to prevent external references from being resolved. MODE: The MODE control statement is used to force an addressing and/or residency mode for a load module. MODE overrides any value set in the ESD CSECT entries or via the JCL PARM field. The format of the MODE control statement is: MODE mode{,mode} 'mode' is either AMODE(24), AMODE(31), or AMODE(ANY) to set addressing mode, and RMODE(24) or RMODE(ANY) to set residency mode. AMODE and RMODE can both be set on one statement. NAME: The NAME statement is used to specify the name of a load module being link edited. The module is stored in the SYSLMOD library using the member name supplied on the NAME statement. The format of the NAME control statement is: NAME memname{(R)} 'memname' is the member name the module is stored under; '{(R)}' is an optional replacement indicator - if the module already exists in the SYSLMOD library, then it will not be replaced unless the '{(R)}' indicator is supplied. NAME should be placed after all other control statements applicable to a given load module. ORDER: The ORDER statement is used to arrange the common areas or CSECTS in a load module into a specified sequence. The ORDER statement should appear before the NAME statement and INCLUDE statements it refers to. The format of the ORDER control statement is: ORDER name{(P)},csectname(P),... The common area name 'name' or 'csectname' values supply the names of the common area and CSECTS to be ordered; they are ordered in the load module in the sequence that they appear on the ORDER statement(s) for that module. The {(P)} value indicates that the 'name' or 'csectname' before it is to reside on a page boundary when the module is loaded for execution. OVERLAY: The OVERLAY statement is used to identify the start of an overlay segment or region. The format of the OVERLAY control statement is: OVERLAY symbol{(REGION)} 'symbol' is the symbolic name assigned to a segment and '(REGION)' identifies the start of an overlay region. PAGE: The PAGE statement forces a given CSECT in the output load module to be linked so that it is aligned on a 4K page boundary when the module is loaded for execution. Binary zero filled empty space is generated by the linkage editor, if necessary, to force the boundary alignment requested. The PAGE statement applies to CSECTs in the module that the next NAME statement refers to. The format of the PAGE control statement is: PAGE name{,csectname}... 'name' is the common name and 'csectname' is the name of CSECT to be page aligned. Multiple CSECTs can be listed on one PAGE statement. REPLACE: The REPLACE statement is used to replace or delete a CSECT or entry point name in a load module. The format of the REPLACE control statement is: REPLACE oldcsect{(newcsect)},... 'oldcsect' is the name of the CSECT being replaced or deleted. '(newcsect)' is the optional new name of the CSECT. If the '(newcsect)' value is omitted and just the 'oldcsect' is coded, then the old CSECT is deleted from the output load module named by the next NAME statement. Multiple CSECTs can be listed on one REPLACE statement. SETCODE: The SETCODE statement sets the APF (Authorized Program Facility) code for a load module. Certain MVS functions require that a program have a non-zero APF code (zero is the default). The format of the SETCODE control statement is: SETCODE AC(n) 'n' is a 1 to 3 digit APF authorization code ranging from 0 to a maximum of 255. 'AC( )' sets the code to 0. Only the last one of multiple SETCODE statements is used. SETCODE affects the output load module named by the next NAME statement. SETSSI: The SETSSI statement is used to set System Status Information (SSI) for the output load module. SETSSI sets an 8-digit hexadecimal code in the output load module for tracking purposes. The format of the SETSSI control statement is: SETSSI xxxxxxxx Where 'xxxxxxxx' is the 8-hex-digit SSI information to be stored with the load module. If SETSSI is not used, not information is stored with the load module. Linkage Editor Usage Examples: JCL to relink a program without linkage editor control statements: //JS10 EXEC PGM=IEWL,REGION=1024K, // PARM='LIST,MAP,XREF' //SYSUT1 DD UNIT=SYSDA, // SPACE=(CYL,(3,2)) //SYSPRINT DD SYSOUT=* //SYSLMOD DD DSN=my.linklib(module), // DISP=SHR //SYSLIN DD DSN=my.object.lib(module), // DISP=SHR JCL to relink a program with linkage editor control statements: //JS10 EXEC PGM=IEWL,REGION=1024K, // PARM='LIST,MAP,XREF' //SYSUT1 DD UNIT=SYSDA, // SPACE=(CYL,(3,2)) //SYSPRINT DD SYSOUT=* //SYSLMOD DD DSN=my.linklib, // DISP=SHR //OBJLIB DD DSN=my.object.lib, // DISP=SHR //SYSLIN DD * INCLUDE OBJLIB(module) GET OBJECT MODULE ENTRY csectname IDENTIFY ENTRY POINT IF NOT 1ST CSECT ORDER csect1(P),csect2,csect3 ALIGN AND LINK EDIT CSECTS IN ORDER GIVEN MODE AMODE(31) SET 31 BIT ADDRESSING MODE MODE RMODE(ANY) SET RESIDENCY MODE OF 24 FOR 31 BIT ADDRESS NAME module(R) REPLACE MODULE IN SYSLMOD DATA SET // |
output generated using printer-friendly topic mod. All times are GMT - 5 Hours