The advice and restrictions listed in Programming in PL/I apply to PL/I programs running under Language Environment®.
Language Environment-conforming PL/I programs can CALL a program that appears in a FETCH or RELEASE statement and can RELEASE it subsequently.
There are some restrictions on the PL/I for MVS™ & VM statements that can be used in a fetched procedure. These restrictions are described in PL/I MVS & VM Language Reference.. Many of the restrictions have been removed with VisualAge® PL/I. See the VisualAge PL/I for OS/390 Compiler and Run-Time Migration Guide.
To enable a PL/I procedure to be fetched, code the option FETCHABLE in the OPTIONS on the PROCEDURE statement. This option indicates that the procedure can only be invoked dynamically. An OPTIONS(MAIN) procedure cannot be fetched; FETCHABLE and MAIN are mutually exclusive options. Treat the FETCHABLE procedure like a normal CICS® program: that is, link-edited with any required subroutines, placed in the CICS application program library, defined, and installed as a program, either in the CSD or using program autoinstall.
No special considerations apply to the use of FETCH when both the fetching and the fetched programs have the same AMODE attribute. Language Environment , however, also supports the fetching of a load module that has an AMODE attribute different to the program issuing the FETCH. In this case, Language Environment performs the AMODE switch, and the following constraints apply:
INCLUDE SYSLIB(CEESTART)
INCLUDE SYSLIB(CEESG010)
INCLUDE SYSLIB(DFHELII)
REPLACE PLISTART
CHANGE PLIMAIN(CEEMAIN)
INCLUDE mainprog
INCLUDE subprog1
.......
.......
ORDER CEESTART
ENTRY CEESTART
NAME progname(R)
The INCLUDE statement for the object modules
must come immediately after the CHANGE statement and there is also a requirement
under Language Environment that the main program must be included before any
subroutines. (This requirement did not exist for modules produced by non-conforming
compilers.) For Enterprise PL/I programs
that are compiled with OPTIONS(FETCHABLE), the binder ENTRY statement must
be the name of the PROCEDURE.