TAA Tools
RTVGENMBR       RETRIEVE GENERIC MEMBER                TAAMBRH

The  Retrieve  Generic  Member  command  simplifies  the  interface  to
RTVMBRD  when a  generic  group of  members  should be  processed.   If
RTVMBRD  is used directly,  it takes a  good deal of  logic to properly
process a generic  group.   Using RTVGENMBR, the  following would be  a
typical  approach.     Assume  the  &MBR  variable  is   passed  in  or
determined within the program.

Note  that  the following  code is  in  a format  that  is ready  to be
copied into a source member using the SEU copy function.

             DCL        &MBR *CHAR LEN(10)
             DCL        &GENNAME *CHAR LEN(10)
             DCL        &RTNMBR *CHAR LEN(10)
             DCL        &SEQ *CHAR LEN(6)
                        /*                                          */
                        /*  Determine generic member name to        */
                        /*    process in the variable &MBR.         */
                        /*  The name does not need a trailing '*'   */
                        /*                                          */
             CHGVAR     &GENNAME &MBR /* Use same value as generic  */
                        /*                                          */
                        /*    Change the lib/file to your own       */
                        /*                                          */
             CHGVAR     &SEQ '*FIRST' /* Set for 1st member */
 RTVGEN:     RTVGENMBR  FILE(xxxxxx/QCLSRC) MBR(&MBR) +
                          GENNAME(&GENNAME) SEQUENCE(&SEQ) +
                          RTNMBR(&RTNMBR)
             MONMSG     MSGID(CPF9815) EXEC(DO) /* No members */
                        /*                                          */
                        /*        If no generic member exists       */
                        /*                                          */
             ENDDO      /* No members exist to match generic name */
             CHGVAR     &SEQ '*NEXT' /* Set for 2nd and Nth mbr */
                        /* After 1st mbr, &RTNMBR is blank for end */
             IF         (&RTNMBR *NE '  ') DO /* Member found */
                        /*                                          */
                        /*          Process the member              */
                        /*                                          */
                        /* Change &MBR to be the previous member */
             CHGVAR     &MBR &RTNMBR /* Allow next mbr access */
             GOTO       RTVGEN /* Get next member */
             ENDDO      /* Member found */
                        /*                                          */
                        /*          End of generic group            */
                        /*                                          */

Unlike the RTVMBRD command, you  specify a generic name in the  GENNAME
parameter and let  the command determine if  the next member is  in the
generic  group.   This name does  not have  to have  an '*'.   The same
value should be used each time a new generic group is processed.

The SEQUENCE parameter must  be set to *FIRST  for the first member  of
the group.  After  the first member is read, the  SEQUENCE parameter is
set  to  *NEXT.   This  parameter  describes  the  meaning  of the  MBR
parameter.   If  *FIRST is specified,  the MBR parameter  should be the
same generic  name as  used for  the GENNAME  parameter.   If *NEXT  is
specified,  the   MBR  parameter   should  be  the   member  previously
processed.

When  SEQUENCE(*FIRST) is specified, at least  one member must exist in
the generic  group.   The actual  member name  found is  placed in  the
RTNMBR  parameter.   If no  member exists  to match  the generic  name,
CPF9815 is sent as an escape message.

When SEQUENCE(*NEXT)  is specified, the RTNMBR variable  will be set to
blanks when there are no more  members in the generic group (No  escape
message is sent).

The important rules to remember in the use of RTVGENMBR:

  **   Determine the  generic name  to be  processed.   Your code  must
       decide this.  The name does not need a trailing '*'.

  **   Before using RTVGENMBR for the first member of the group.

         --   Use  the same value  determined for  the generic  name in
              both the GENNAME and MBR parameters.

         --   Set the SEQUENCE parameter to the value *FIRST.

  **   After using RTVGENMBR for the first member of the group.

         --   Set the SEQUENCE parameter to *NEXT.

         --   If  a  member exists,  set MBR  to be  the same  value as
              RTNMBR before using RTVGENMBR again.

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

   FILE          The qualified file name  to be accessed.  The  library
                 entry defaults to *LIBL.

   MBR           The  member  to  be  accessed.   This  should  be  the
                 generic  name or the  only member.  If  a generic name
                 is  used,  it  does  not   need  an  *  as  the   last
                 character.

                 After  the  first  member  has  been  retrieved,  this
                 value  should be set  to the  name of the  last member
                 retrieved.

   GENNAME       The generic name to be  compared against.  The *  does
                 not need to be included.

   SEQUENCE      Enter  *FIRST if  this  is  the  first member  of  the
                 generic group.   If the  first member does  not exist,
                 an  escape  message  (CPF9815) will  be  sent.   *NEXT
                 should be specified  for each following member  of the
                 group.   If no  more members  exist, the  RTNMBR field
                 will be blank.

   RTNMBR        The  member found.  If  SEQUENCE(*FIRST) is specified,
                 RTNMBR will contain  the name of  the first member  in
                 the  group.   If  SEQUENCE(*NEXT)  is specified,  this
                 return  variable will contain  the member  name if one
                 was found.  If not, the member name will be blank.

                 This is a  return variable that  must be specified  as
                 *CHAR LEN(10).

   RTNSYSTEM     Whether the  file exists  on the  local system  (*LCL)
                 or a remote system if DDM is being used (*RMT).

                 This  is  an optional  return  variable  that must  be
                 specified as *CHAR LEN(10) if it is used.

   RTNLIB        The library where the file was found.

                 This  is  an  optional return  variable  that  must be
                 specified as *CHAR LEN(10) if it is used.

The following list of  return variables may be optionally  specified if
more about the member found (besides it's name) is needed:

     Keyword    Type    Len     Description
     -------    ----    ---     -----------

     FILEATR    *CHAR    3      File attribute (*PF *LF)
     FILETYPE   *CHAR    5      File type (*SRC *DATA)
     SRCTYPE    *CHAR   10      Source type (CLP RPG ...)
     SRCCHGDAT  *CHAR   13      Last source change date C-YYMMDD-HHMMSS
     CRTDATE    *CHAR   13      Create date - C-YYMMDD-HHMMSS
     EXPDATE    *CHAR    7      Expiration date - C-YYMMDD
     TEXT       *CHAR   50      Member text
     NBRCURRCD  *DEC    10 0    Number of current records
     NBRDLTRCD  *DEC    10 0    Number of deleted records
     SHARE      *CHAR    4      Shared member (*YES *NO)
     DTASPCSIZ  *DEC    10 0    Data space size
     ACCPTHSIZ  *DEC    10 0    Access path size
     CHGDATE    *CHAR   13      Change date - C-YYMMDD-HHMMSS
     SAVDATE    *CHAR   13      Save date - C-YYMMDD-HHMMSS
     RSTDATE    *CHAR   13      Restore date - C-YYMMDD-HHMMSS
     NBRDTAMBR  *DEC     2 0    Number of data members in a logical
                                  file. This field will be zero for
                                  a physical file.

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

The following TAA Tools must exist on your system:

    CHKGENERC      Check generic
    SNDESCMSG      Send escape message

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

None, the tool is ready to use.

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

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

   RTVGENMBR     *CMD                       TAAMBRH       QATTCMD
   TAAMBRHC      *PGM           CLP         TAAMBRHC      QATTCL
					

Added to TAA Productivity tools April 1, 1995


Home Page Up to Top