TAA Tools

The Swap  Library  List Entry  command is  designed  for the  situation
where  you want to  add a library  to the  user portion of  the library
list,  but the  user may  already have  a list  that is at  the maximum
number (25 libraries).

SWPLIBLE is  designed to  swap out  the last  library on  the list  and
insert your library.   When you have completed  your function, you swap

For  example, assume you need to add  the library NEWLIB to the library
list and do  not know if  the list is  at the  maximum.  The  following
code operates correctly whether the user is at the maximum or not:

             DCL        &RTNLIB *CHAR LEN(10)
              .           /* Your function using the added lib */

If the library list  is not at the maximum, no library  is removed from
the  library list, NEWLIB  is added to  the list and  the special value
*NONE is  returned in  the return  variable &RTNLIB.   If  the  library
list is at  the maximum, RTNLIB contains  the name of the  library that
was  removed from the  list -  RMVLIB(*LAST) requests the  last library
on the list.

When  it  is  time  to  reset the  library  list,  the  second SWPLIBLE
command adds  the RTNLIB library  from the  first SWPLIBLE and  removes
the  specified library.   If  the first  SWPLIBLE command  had returned
*NONE for RTNLIB, no library is added.

The  SWPLIBLE command uses  the system commands  ADDLIBLE and RMVLIBLE.
If you attempt  to add  a library  that already exists  on the  library
list, the system  sends CPF2103 as an  escape message.  If  you attempt
to  remove a  library  that does  not exist  on the  library  list, the
system sends CPF2104  as an  escape message.   These  messages will  be
resent to your program.

Command parameters                                    *CMD

   ADDLIB        The library  to be  added to  the library  list.   The
                 special value  *NONE exists to cause no  library to be

   ADDPOS        The  position in the library  list to add the library.
                 *FIRST and  *LAST  are the  only  values that  may  be
                 entered  and have  the  same meaning  as on  ADDLIBLE.
                 *LAST   is  the   default.    The   reference  library
                 function supported  on ADDLIBLE  is not  supported  on

   RMVLIB        The library  to be removed from  the library list.   A
                 specific  library or  the special  value *LAST  may be
                 specified.  *LAST is the default.

                 If *LAST is specified and  the library list is not  at
                 its  maximum, no  library is  removed  and the  RTNLIB
                 value will  be *NONE.   If the library list  is at its
                 maximum, the last library in the list is removed.

   RTNLIB        A  return  variable that  is  optional.   If  used, it
                 must be  declared as  *CHAR  LEN(10).   The intent  of
                 this   parameter   is  for   it   to   be  used   when
                 RMVLIB(*LAST)  is used.   The  value returned  will be
                 *NONE (if no library was  removed) or the name of  the
                 library removed.


Because the  command returns a variable,  SWPLIBLE can only be  used in
a CL program.


The following TAA Tools must be on your system:

     SNDCOMPMSG   Send completion message


None, the tool is ready to use.

Objects used by the tool

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

   SWPLIBLE      *CMD                   TAALIBM       QATTCMD
   TAALIBMC      *PGM       CLP         TAALIBMC      QATTCL

Added to TAA Productivity tools October 15, 2013

Home Page Up to Top