Referencing Nested Blocks

Open PL/I program blocks may be nested. Rules for naming nested blocks are as follows:

  1. If a block defined within the compilation unit is contained within or contains the debugger's current evaluation environment, the block may be referred to simply by its name. The name may need to be qualified to make it unique within the external procedure.

    If the block contains the debugger's current evaluation environment, the search for the referenced block begins from the current environment and continues through each successive containing (parent) block until the referenced block is found.

  2. If a block is in some other external procedure, it must be qualified with at least the external procedure name, and it may require further qualification. Furthermore, a fully qualified name to a block in some other external procedure may be the same as a partially qualified block name in the current procedure. To force the debugger to search outside the current procedure, qualify the block name with %EXTERN. (This is seldom necessary if ambiguous naming is avoided.)

    For example:

    A: proc;        /* 1 */        B: proc;             /* 8 */
      B: proc;      /* 2 */          C: proc;           /* 9 */
        C: proc;    /* 3 */            D: proc;         /* 10 */
          D: proc;  /* 4 */            end D;
          end D;                     end C;
        end C;                         B: proc;         /* 11 */
      end B;                             A: proc;       /* 12 */
      C: proc:      /* 5 */                A: proc      /* 13 */
        B: proc;    /* 6 */                  B: proc;   /* 14 */
          C:proc;   /* 7 */                  end B;
          end C;                           end A;
        end B;                           end A;
      end C;                           end B;
    end A;                          end B;

The following describes how each block can be referenced given the current evaluation environment in the external procedure %EXTERN.A (block 1).

Block     
Reference
   1 A or %EXTERN.A
   2 A.B, B, or %EXTERN.A.B
   3 B.C, A.B.C, or %EXTERN.A.B.C.
   4 D, C.D, B.C.D, A.B.C.D, %EXTERN.A.B.C.D, B.D, A.B.D, %EXTERN.A.B.D, A.D, or %EXTERN.A.D
   5 C, A.C, or %EXTERN.A.C
   6 C.B, A.C.B, or %EXTERN.A.C.B
   7 C.C, C.B.C, A.C.C, %EXTERN.A.C.C, A.C.B.C, or %EXTERN.A.C.B.C
   8 %EXTERN.B
   9 %EXTERN.B.C
 10 %EXTERN.B.D, or %EXTERN.B.C.D
 11 B.B or %EXTERN.B.B
 12 B.B.A or %EXTERN.B.B.A
 13 B.A.AB.B.A.A, %EXTERN.B.A.A, or %EXTERN.B.B.A.A
 14 B.B.B B.A.B B.A.A.B, B.B.A.B, %EXTERN.B.B.B, %EXTERN.B.A.B, %EXTERN.B.A.A.B, %EXTERN.B.B.A.B, or%EXTERN.B.B.A.A.B

If the current evaluation environment is in the internal procedure block %EXTERN.A.B.C.D (block 4), the following is true in the debugger:

B refers to block 2
B.C refers to block 3
C refers to block 3
%EXTERN.B.A is an ambiguous reference (block 12 or 13)
%EXTERN.B.B.A       refers to block 12
%EXTERN.B.C refers to block 9

If the current evaluation environment is in the external procedure block %EXTERN.B (block 8), the following is true in the debugger:

A.B.C.D      refers to block 1
A is an ambiguous reference (block 12 or 13)
B refers to block 11
B.A refers to block 12
A.B refers to block 14
B.A.B refers to block 14