• Aucun résultat trouvé

LINKAGE EDITOR PROCESSING

Dans le document OS PL/I Optimizing Compiler: (Page 94-99)

SYSlIN (primary input)

PL/I object module

Pl/I library (SYSl.PlIBASE)

SYSLIB (call library)

A Pl/I program, compiled by the optimizing compiler, cannot be executed until the appropriate library subroutines have been included. These subroutines are included in two ways:

1. By inclusion in the load module during link editing.

2. By dynamic call during execution.

The first method is used for most of the Pl/I resident library subroutines; the following paragraphs describe how the linkage editor locates them. The second is u~ed for the Pl/I transient library subroutines, for example those concerned with input and output (including those used for opening and closing files), and those that generate execution-time messages.

In basic processing, as shown in Figure 20, the linkage editor accepts from its primary input source a data set defined by the OD statement with the name SYSLIN. For a Pl/! program, this input is the object module produced by the compiler. The linkage editor uses the external symbol dictionary in this object module to determine whether the module includes any external references for which there are no corresponding external symbols in the module: it attempts to resolve such references by a method termed automatic library call.

linkage editor

SYSLMOO (load) module library)

Figure 20. Basic Linkage Editor Processing

External symbol resolution by automatic library call involves a search of the data set defined by the DO statement with the name SYSlIB; for a PL/I program, this will be the PL/! resident

library. The linkage editor locates the subroutines in which the external symbols are defined (if such subroutines exist), and includes them in the load module.

The linkage editor always places its output (that is, the load module) in the data set defined by the DD statement with the name SYSLMOD.

Any linkage editor processing additional to the basic processing described above must be specified by linkage editor control statements placed in the primary input. These control statement are described under "Additional Processing" on page 79.

JOB CONTROL LANGUAGE FOR THE LINKAGE EDITOR

EXEC STATEMENT

Although you will probably use cataloged procedures rather than supply all the job control language (JCL) required for a job step that invokes the linkage editor" you should be familiar with these JCL statements so that you can make the best use of the linkage editor and" if necessary" override the statements of the cataloged procedures.

The IBM-supplied cataloged procedures that include alink-~dit . procedure step are:

PLIXCL Compile and link edit

PLIXCLG Compile, link edit, and execute PLIXlG Link edit and execute

The following paragraphs describe the essential JeL statements for link editing. The IBM-supplied cataloged prricedures are described in Chapter 9" "Cataloged Procedures"'on page 273, and include examples of these statements.

The name of the linkage editor is HEWL.

The aliases IEWL or LINKEDIT are often used for the linkage editor.

The basic EXEC statement is:

//stepname EXEC PGM=IEWL

By using the PARM parameter of the EXEC statement, you can select one or more of the optional facilities provided by the linkage editor; these facilities are described under "Optional Facilities" on page 74.

DD STATEMENTS FOR THE STANDARD DATA SETS

ddniune

SYSLIN SYSLMOD SYSUTI SYSPRINT

The linkage editor always requires four standard ·data sets. You must define these data sets in DD statements with the ddnames SYSLIN" SYSLMOD, SYSUTl" and SYSPRINT.

A fifth data set, defined by a DD stat~ment with the name

SYSLIB, is necessary if you want to use automatic library call.

The five data set names, together with other characteristics of the data sets, are shown in Figure 21.

Contents Possible device classes1

Primary input data, normally UNIT=SYSSQ or input job stream the compiler output (specified by DD ~E)

Load module UNIT=SYSDA

Temporary workspace UNIT=SYSDA

Listing" including messages UNIT=SYSSQ (or SYSOUT=)

Figure 21 (Part 1 of 2). Linkage Editor Standard Data Sets

70 OS Pl/I Optimizing Compiler: Programmer's Guide

ddname ' Contents Possible device classes1

SYSLIB Automatic call library UNIT=SYSDA (normally the PL/I resident

library)

Figure 21 (Part 2 of 2). Linkage Editor Standard Data Sets

1 SYSSQ Magnetic tape or direct-access device SYSDA Direct access device

PRIMARY INPUT (SYSLINl

OUTPUT (SYSLMODl

Primary input to the linkage editor must be a standard data set defined by a DD statement with the name SYSLIN; this data set must have consecutive organization. The input must comprise one or more object modules and/or linkage editor control sta'tements;

a load module cannot be part of the primary input1 although i t can be introduced by the control statement INCLUDE. For a Pl/I program the primary input is usually a data set containing an object module produced by the compiler. This data set may be on magnetic tape or on a direct-access device1 or you can include i t in the input job stream. In all cases, the input must be in the form of 80-byte F~format records.

The IBM-supplied cataloged procedure PLIXLG includes the DD statement:

//SYSLIN DD DDNAME=SYSIN

This statement specifies that the primary input data set may be defined in a DD statement with the name SYSIN. If you use this cataloged procedure, specify this DD statement by using the qualified ddname LKED.SYSIN. For example, to link edit and execute an object module placed in the input stream, you can use the following statements:

//LEGO //STEPI //LKED.SYSIN

JOB

EXEC PLIXLG

DD

*

(insert here the object module to be link edited and executed)

If object modules with identically named control sections appear in the primary input, the linkage editor processes only the first appearance of that control section.

You can include load modules or object modules from one or more libraries in the primary input by using a linkage editor INCLUDE statement as described under "Additional Processing" on page 79.

Output (that iS1 one or more load modules) from the linkage editor is always stored in a data set defined by the DD

statement with the name SYSlMOD, unless you specify otherwise.

This data set is usually called a library; libraries are fully described in Chapter 81 "Libraries of Data Sets" on page 264.

The IBM-supplied cataloged procedures include the following DD statement:

//SYSLMOD DD DSNAME=&&GOSETCGO), // UNIT=SYSDA,

// DISP=(MOD,PASS), // SPACE=(1024,(SO,20,I»

This statement defines a temporary library named &&GOSET and assigns the member name GO to the load module produced by the linkage editor. To retain the load module after execution of the job, replace this DD statement with one that defines a permanent library. For example, assume that you have a

permanent library called USlIB on 3330 disk pack serial number 371; to name the load module MODI and place it in this library, code:

//LKED.SYSlMOD DD DSNAME=USlIBCMODl)1 // UNIT=3330,VOl=SER=371,DISP=OlD

The SPACE parameter in the DD statement with the name SYSlMOD used in the IBM-supplied cataloged procedures allows for an initial allocation of SOK bytes and, if necessary, IS further allocations of 20K bytes (a total of 350K bytes); this should suffice for most applications.

TEMPORARY WORKSPACE (SYSUT1J

The linkage editor requires a data set for use as temporary workspace. It is defined by a DD statement with the name SYSUTI. This data set must be on a direct-access device. The following statement contains the essential parameters:

//SYSUTI DD UNIT=SYSDA, // SPACE=CI024,(200,20»

You should normally never need to alter the DD statement with the name SYSUTI in an IBM-supplied cataloged procedure, except to increase the SPACE allocation when processing very large programs.

If your installation supports dedicated workfiles, these can be used to provide temporary workspace for the link-edit job step, as described under "Compile and Link-Edit (PLIXCL)" on page 278.

AUTOMATIC CALL LIBRARY (SYSLIBJ

Unless you speci fy otherwise, the linkage edi tor will ah"ays attempt to resolve external references by automatic library call

(see "linkage Editor Processing" on page 69). To enable it to do this, you must define the data set or data sets to be

searched in a DD statement with the name SYSlIB. (To define second and subsequent data sets, include additional, unnamed, DD statements immediately after the DD statement SYSlIB; the data sets so defined will be treated as a single continuous data set for the duration of the job step.)

For a PL/I program, the DD statement SYSLIB will normally define the PL/I resident library. The subroutines of the resident library are stored in two data sets, SYSl.PlIBASE (the base library) and SYSI.PlITASK (the multitasking library). The base library contains all the resident library subroutines required by a nonmultitasking program. The multitasking library contains subroutines that are peculiar to multitasking, together with multitasking variants of some of the base library subroutines.

For link editing a nonmultitasking program, specify only the base library in the SYSlIB DD statement. The following DD statement will usually sufficel

//SYSlIB DD DSN=SYSI.PlIBASE,DISP=SHR

72 as Pl/I Optimizing Compiler: Programmer's Guide

For link editing a multitasking program1 specify both the multitasking library and the base library. When attempting to resolve an external reference, the linkage editor will first search the multitasking library; if it cannot find the required subroutine1 it will then search the base library. To ensure that the search is carried out in the correct sequence1 the DD statements defining the two sections of the library must be in the correct sequence: multitasking library first1 base library second. The following DD statements will usually suffice:

//SYSLIB DO DSNAME=SYS1.PLITASK 1DISP=SHR // DO DSNAME=SYS1.PLIBASE 1DISP=SHR LISTING (SYSPRINTl

The linkage editor generates a listing that includes reference tables relating to the load modules that it produces and als01 when necessarY1 messages. The information that can appear is described under "Listing Produced by the Linkage Editor" on page 75.

You must define the data set on which you wish the linkage editor to store its listing in a DD statement with the name SYSPRINT. This data set must have consecutive organization.

Although the listing is usually printed 1 it can be stored on any magnetic-tape or direct-access device. For printed output 1 the following statement will suffice:

//SYSPRINT DD SYSOUT=A EXAMPLE OF LINKAGE EDITOR JCL

//LINK //STEPI //SYSLMOD

/ /

//SYSUTI //SYSPRINT //SYSLIB //SYSLIN

JOB

A typical sequence of job control statements for link editing an object module is shown in Figure 22. The DD statement SYSLIN indicates that the object module will follow immediately in the input stream; for example, it might be an object deck created by invoking the optimizing compiler with the DECK option, as

described under "DECK Option" on page 19. The DD statement with the name SYSLMOD specifies that the linkage editor is to name the load module LKEX, and that it is to place it in a new library name MODLIB; the keyword NEW in the DISP parameter indicates to the operating system that this DD statement specifies the creation of a library.

EXEC PGM=IEWL

DD DSNAME=MODLIBCLKEX),UNIT=3330,VOL=SER=D186, SPACE=CCYL,CIO,lO,l»,DISP=CNEW,KEEP)

DD UNIT=SYSDA,SPACE=CI024 1C200,20»

DD SYSOUT=A

DD DSNAME=SYS1.PLIBASE,DISP=SHR DD

*

Cinsert here the object module to be link-edited)

Figure 22. Typical Job Control Statements for Link-Editing a PL/I Program

Dans le document OS PL/I Optimizing Compiler: (Page 94-99)