Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Programming Guide

PACKAGEs versus nested PROCEDUREs

Calling nested procedures requires that an extra hidden parameter (the backchain pointer) is passed. As a result, the fewer nested procedures that your application contains, the faster it runs.

To improve the performance of your application, you can convert a mother-daughter pair of nested procedures into level-1 sister procedures inside of a package. This conversion is possible if your nested procedure does not rely on any of the automatic and internal static variables declared in its parent procedures.

If procedure b in Example with nested procedures does not use any of the variables declared in a, you can improve the performance of both procedures by reorganizing them into the package illustrated in Example with packaged procedures.

Example with nested procedures

a: proc;

  dcl (i,j,k) fixed bin;
  dcl ib      based fixed bin;
   .
   .
   .
  call b( addr(i) );
   .
   .
   .
  b: proc( px );
    dcl px      pointer;
    display( px->ib );
  end;
end;

Example with packaged procedures

p: package exports( a );

  dcl ib      based fixed bin;

  a: proc;

    dcl (i,j,k) fixed bin;
   .
   .
   .
    call b( addr(i) );
   .
   .
   .
  end;

  b: proc( px );
    dcl px      pointer;
    display( px->ib );
  end;

end p;

Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)