PROCEDURENAME 関数

目的

最も近くにある入れ子になったプロシージャの名前を示す文字列を返します。PROCNAME() を使用しても同じです。

構文

PROCEDURENAME();
または
PROCNAME();

例 1:

myprog: proc options(main);

    dcl procedurename builtin;

    call sub1(procedurename());

   sub1: proc( caller);
  
    dcl caller char (*);

    put skip list('The calling procedure is: ' || caller);

    /* Note: procname() is equiv. of procedurename() */
    put skip list('The current procedure is: ' || procname());

   end;
end;

This program prints:

The calling procedure is: MYPROG
The current procedure is: SUB1

例 2:

   /* Since Open PL/I does not support Packages, the name of the outermost  */
   /* procedure is aways returned for the PACKAGENAME() built-in.          */

Micro: proc options(main);

    call Focus();

    Focus: proc;
           put skip list (packagename() || ' ' || procedurename() );
    end;

end;

次のように表示されます。

MICRO FOCUS