CHKMBR2         CHECK MEMBER NBR 2                     TAAOBJQ

 The  Check Member  Nbr  2  command is  similar  to the  system  command
 CHKOBJ except  that CHKMBR2 sends  an escape message if  the member 'is
 found'.   The intent  of the command  is to simplify  coding when it is
 considered an  error  if the  member  exists.   A similar  function  to
 check for an object in existence is done by the CHKOBJ2 tool.

 CHKMBR2 sends  message ID  TAA9891 as an  escape message if  the member
 exists.  If the member does not exist, no message is sent.

 CHKMBR2  internally  issues  the  CHKOBJ  command.    All other  escape
 messages from CHKOBJ are resent.

 A typical solution would be:

             CHKMBR2      FILE(FILEA) MBR(MBR1)
             MONMSG       MSGID(TAA9891) EXEC(DO) /* Member exists */
                          /*                                       */
                          /*   Your coding for the member exists   */
                          /*                                       */
             ENDDO        /* Member exists */

 Using CHKOBJ, the coding would be as follows:

             CHKOBJ       OBJ(FILEA) OBJTYPE(*FILE) MBR(MBR1)
             MONMSG       MSGID(CPF9815) EXEC(DO) /* No member */
             RCVMSG       MSGTYPE(*EXCP) /* Remove the escape */
             GOTO         ENDCHK
             ENDDO        /* No member */
                          /*                                      */
                          /*   Your coding for the member exists  */
                          /*                                      */
  ENDCHK:                 /* Member exists */

 Note that  with the  CHKOBJ solution,  you have  to  branch around  the
 code that  the application  considers an  error.   The GOTO with  label
 solution  operates  correctly,  but  can  also  be  a cause  of  coding
 errors.  CHKMBR2 allows you to code the condition more normally.

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

    FILE          The qualified file name.   The library value  defaults
                  to *LIBL.  *CURLIB may also be specified.

    MBR           The member  name.   The  special value  *FIRST may  be
                  used.

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

 None.

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

 The following TAA Tools must be on your system:

      SNDESCMSG       Send escape message

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

 None, the tool is ready to use.

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

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

    CHKMBR2       *CMD                   TAAOBJQ       QATTCMD
    TAAOBJQC      *PGM       CLP         TAAOBJQC      QATTCL

Added to TAA Productivity Tools May 1, 1996


Home Page

Powered by AS/400Powered by AS/400 Last modified on July 15, 2010 © 1995, 2010 - Jim Sloan, Inc.