Returns the name of the most closely nested procedure as a character-string. PROCNAME() can be used equivalently.
Example 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
Example 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;
will print:
MICRO FOCUS