Fetching modules with different AMODEs

Language Environment supports the PL/I FETCH/RELEASE facility. No special considerations apply to this support when both the fetching executable program and the fetched executable programs have the AMODE(ANY) attribute or both have the AMODE(24) attribute.

Language Environment also supports the fetching of a load module that has a different AMODE attribute than the executable program issuing the FETCH statement. Language Environment performs the AMODE switches in this case, and the following constraints apply:
  • If any fetched module is to execute in 24-bit addressing mode, the fetching module must be loaded into storage below 16M, and must have the RMODE(24) attribute regardless of its AMODE attribute.
  • Any variables passed as parameters to a fetched routine must be addressable in the AMODE of the fetched procedure. For any fetched executable program that is to be executed in 24-bit addressing mode, you must ensure that:
    • If any parameter resides in a HEAP area, the BELOW suboption of the HEAP option is specified.
    • If any parameter resides in STATIC storage of the fetching executable program, the fetching executable program has the RMODE(24) attribute so that its STATIC storage is below 16M.
    • If any parameter resides in AUTOMATIC storage, no special considerations apply because ALL31(OFF) and STACK(,,BELOW) runtime options have been used. If the two constraints described previously cause problems, then you can copy the variable to a like variable with the AUTOMATIC attribute and pass the copy to the fetched AMODE(24) procedure, with the BELOW suboption of the HEAP option specified.
  • PL/I object modules can be link-edited into overlay executable programs and run as overlay executable programs. Such programs have the attributes AMODE(24) and RMODE(24).

When a PL/I routine fetches another PL/I procedure, it is possible for a condition to arise in the fetched procedure for which a PL/I ON-unit was established in the fetching procedure.

PL/I imposes the restriction that if an ON-unit is established while the current addressing mode is 24-bit, and the condition is raised while the addressing mode is 31-bit, the ON-unit is not invoked. This is because PL/I must invoke the ON-unit in the addressing mode in which it was established. If the ON-unit was established in 24-bit addressing mode but the condition arose in 31-bit addressing mode, the code and data required to process the error might not even be addressable in 24-bit addressing mode.