Link-editing fetchable executable programs

The PL/I FETCH and RELEASE statements dynamically load separate executable programs that can be subsequently invoked from the PL/I routine that fetches the executable program. There are some restrictions on the PL/I for MVS & VM statements that can be used in fetched procedures. These are described in the IBM Enterprise PL/I for z/OS library.

Many of those restrictions have been removed with Enterprise PL/I for z/OS. See the IBM Enterprise PL/I for z/OS library for the use of FETCH with that compiler.

Fetchable (or dynamically loaded) modules should be link-edited into an executable program library that is subsequently made available for the job step by means of a JOBLIB or STEPLIB DD statement. The FETCH statement can access modules stored in link-pack areas (both the LPA and the ELPA). The search order for modules is defined by z/OS; see Program library definition and search order for details.

The step that link-edits a fetchable executable program into a library requires the following linkage editor control statements:
  • An ENTRY statement to define the entry point into the PL/I routine.
  • A NAME statement to define the name used for the fetchable executable program. This statement is required if the NAME compiler option is not used and if the name is not specified in the DSN parameter in the SYSLMOD DD statement used to define the executable program library.

    The name or any alias by which the fetchable executable program is identified in the executable program library must appear in a FETCH or RELEASE statement within the scope of the invoking procedure.

Figure 1. Example of link-editing a fetchable executable program
//FETCH JOB
//STP       EXEC IEL1CL
//PLI.SYSIN DD *
⋮
    PL/I source(fetchable)
⋮
/*
//LKED.SYSLIN DD *
  ENTRY   procedure-name
  INCLUDE OBJMOD
  NAME FETCH1
/*
//LKED.SYSLMOD DD DSN=PRVLIB,...
//LKED.OBJMOD  DD DSN=&&LOADSET,DISP=(OLD,...

Language Environment-conforming COBOL or C modules can be loaded dynamically by the PL/I FETCH statement. The cataloged procedure IEL1CL includes both the compilation and the link-editing of the fetchable PL/I module. For more details on cataloged procedure IEL1CL, see the IBM Enterprise PL/I for z/OS library.