RTVPGMNAM       RETRIEVE PROGRAM NAME                  TAACLPT

 The Retrieve  Program Name command  is designed for  CL program use  to
 determine  the name and  library of your  current program and  the name
 and library of the calling program.

 Typical commands would be entered as:

               RTVPGMNAM    PGMNAM(&PGM)

               RTVPGMNAM    CALLINGPGM(&PGM)  CALLINGLIB(&LIB)

 There  is no simple  method within a  CL program to  determine the name
 of itself.   RPG  allows access  to the  name  of the  program via  the
 status data  structure.  There  are many ways  that a program  name can
 differ  from the  source member  name so  you do  not always  know when
 coding the program what the name of the object will be.

 There can  be security  considerations within  a  program that  require
 the  caller to  be  a  specific program  name  in  a specific  library.
 RTVPGMNAM can be used to help ensure this.

 Implementation
 --------------

 The  original  coding  of  RTVPGMNAM  used  APIs  to send  and  receive
 messages  from  programs  in  the  stack.    The  message   information
 returned provided  the name of  the program in  the stack, but  not the
 library name.

 Use in OPM
 ----------

 In OPM  the current program  is the program  that uses RTVPGMNAM.   The
 calling program is the previous program in the stack.

 For  example, if PGM1 calls  PGM2 and PGM2 uses  RTVPGMNAM, PGM2 is the
 current program and PGM1 is the calling program.

 Use in ILE
 ----------

 Assume PGM1  calls  an ILE  program  PGM2 which  has  3 modules  (MOD1,
 MOD2,  and MOD3).   MOD1  calls  MOD2 which  calls MOD3  and MOD3  uses
 RTVPGMNAM.

 The  current  program is  returned  as PGM2.   The  calling  program is
 returned as PGM1.  Note that the modules are not considered.

 Command parameters                                    *CMD
 ------------------

    PGMNAM        The return  value of  the current  program  name.   It
                  must be declared as *CHAR LEN(10).

    PGMLIB        The  return  value  of the  current  program  library.
                  There  is  a performance  degradation if  the  name of
                  the library  is requested.   It  must be  declared  as
                  *CHAR LEN(10).

    CALLINGPGM    The return  value  of the  calling program  name.   It
                  must be declared as *CHAR LEN(10).

    CALLINGLIB    The  return  value  of  the calling  program  library.
                  There  is  a performance  degradation  if the  name of
                  the library  is requested.    It must  be declared  as
                  *CHAR LEN(10).

 Restrictions
 ------------

 Because the  command returns  variables, it can  only be executed  in a
 CL program.

 Prerequisites
 -------------

 The following TAA Tools must be on your system:

       RTVPGMSTK2    Retrieve program stack 2

 Implementation
 --------------

 None, the tool is ready to use.

 Objects used by the tool
 ------------------------

    Object        Type        Attribute      Src member    Src file
    ------        ----        ---------      ----------    ----------

    RTVPGMNAM     *CMD                       TAACLPT       QATTCMD
    TAACLPTC      *PGM           CLP         TAACLPTC      QATTCL

Added to TAA Productivity Tools April 1, 1995


Home Page

Powered by AS/400Powered by AS/400 Last modified on October 10, 2008 © 1995, 2008 - Jim Sloan, Inc.