The Library Group tool allows you to define a list of libraries in a
group and a current library. The group names may then be specified
on the CHGLIBGRP, ADDLIBGRP, or RMVLIBGRP commands to modify the user
portion of the library list.
A typical command would be:
CHGLIBGRP LIBGRP(GRP1 GRP2 ...)
The command will replace the existing user portion of the library
list with the libraries specified in the group names. It also sets
the current library to the value specified on the first group (GRP1
in the example).
The current library can be defined as *SAME for a library group in
which case no change occurs to the current library.
Up to 10 library groups may be named on either CHGLIBGRP, ADDLIBGRP,
or RMVLIBGRP. The total number of libraries which result after
determining the unique list cannot exceed the system limit of 250.
The major advantage of the Library Group tool is that you can change
the library list without changing CL programs. In addition, for
those users who are reaching the library system limit, the tool may
allow a simpler means of controlling what is really needed at various
processing points.
The library groups can be helpful in identifying a list of libraries
for a specific application that all need to exist on the library list
when the application is run.
Add and Remove library groups
-----------------------------
ADDLIBGRP adds one or more groups of libraries to the existing user
portion of the library list. The current library is not changed.
An option exists on ADDLIBGRP to add at the beginning or end of the
current library list. The default is POSITION(*FIRST) which adds the
libraries at the beginning of the list. If a library about to be
added already exists on the library list, it is bypassed without an
error occurring.
RMVLIBGRP removes the libraries found in the library groups from the
user portion of the library list. The current library is not
changed. If one or all of the libraries named does not exist on the
library list, it is not considered an error.
For example, a typical solution would be:
ADDLIBGRP LIBGRP(GRP1)
.
. /* Your function */
.
RMVLIBGRP LIBGRP(GRP1)
In this example, care must be taken that a library in GRP1 is not
already on the library list when ADDLIBGRP is run because of the
RMVLIBGRP function. Assume the library list is:
QGPL QTEMP LIBA
Assume LIBA is also in GRP1
when ADDLIBGRP is run.
Since only unique libraries would be added to the list, no
error occurs.
However, when RMVLIBGRP is run, it would find the LIBA
library and remove it.
Therefore, the library list would now be:
QGPL QTEMP
If you are concerned about this possibility, a good solution is to
use the RTNLIBL TAA Tool as follows:
DCL &LIBL *CHAR LEN(2750)
.
RTVJOBA USRLIBL(&LIBL)
ADDLIBGRP LIBGRP(GRP1)
.
. /* Your function */
.
RTNLIBL USRLIBL(&USRLIBL)
Creating a library group description
------------------------------------
To create a library group, you must first create a set of data base
files (LIBGRPP and LIBGRPA) that are used by the tool to hold the
Library Group Description.
A typical command would be:
CRTLIBGRPD
By default, the required data base files would be created in library
QGPL so they will be available to all jobs. You can create multiple
sets of files, but only one set per library.
To enter a library group description, the EDTLIBGRPD command would be
used such as:
EDTLIBGRPD
A subfile will be displayed of the existing library groups (if any)
and you are allowed the options of display, change, and delete. The
F6 key is used to enter a new group. Each group must be given a
unique name and a text description.
The basic display for change or add of a list of libraries for each
group is similar to the system display used by EDTLIBL. You may
enter new libraries, delete existing libraries, or change the order.
After making a change and pressing Enter, the current information is
sorted based on sequence number and then re-displayed. When Enter is
pressed without making any changes, the information is updated in the
data base.
No checking occurs that the name entered is a valid library on the
system. This allows you to create groups where the library does not
yet exist (a similar function exists on CRTJOBD).
The PRTLIBGRPD command can be used to check that all of the libraries
specified exist on your system. PRTLIBGRPD may also be used to print
the detail of each of the groups or to find each group that contains
a specific library.
Using library groups from different files
-----------------------------------------
When CHGLIBGRP, ADDLIBGRP, or RMVLIBGRP are used, all groups of
libraries must be specified in the same LIBGRPP file. If the groups
are in files in different libraries, it is possible to specify
multiple commands such as:
ADDLIBGRP LIBGRP(GRP1) LIBGRPPLIB(QGPL)
ADDLIBGRP LIBGRP(GRP2) LIBGRPPLIB(xxxx)
Retrieving a library group description
--------------------------------------
The RTVLIBGRPD command allows you to retrieve the list of libraries
in a group. The libraries are returned in a 275 byte variable in a
similar manner the USRLIBL value is returned on RTVJOBA. The format
is the library name followed by a blank (25 libraries x 11 = 275).
Note that RTVJOBA returns up to 250 libraries while RTVLIBGRPD
returns up to 25.
A typical set of commands would be:
DCL &LIBLIST *CHAR LEN(275)
.
RTVLIBGRPD LIBGRP(GRP1) RTNLIBS(&LIBLIST)
For example, if you wanted to do SAVCHGOBJ against the the list that
is returned, the list is in the proper format to be executed using
QCMDEXC. You would need to build up the SAVCHGOBJ command in a
variable before using QCMDEXC.
Getting started
---------------
1. Determine the library where the files LIBGRPP and LIBGRPA will
be kept that are used by the tool. The default is QGPL which
will be used in the following examples and is assumed to be on
your library list. For most situations, you probably only
want a single set of files for the entire system. However,
some individuals may want their own set for testing or special
situations. QGPL is assumed in the following examples.
2. Create the files used by the tool with:
CRTLIBGRPD
3. Use the edit command to create the required groups:
EDTLIBGRPD
Use F6 to enter each group and fill in the list of libraries.
4. You are now ready to use the CHGLIBGRP command. To test the
function, name a few of your groups and then use DSPLIBL to
check the user portion of the library list.
CHGLIBGRP LIBGRP(GRP1 GRP2 ...)
DSPLIBL
5. Try the ADD/RMVLIBGRP commands also.
CRTLIBGRPD Command parameters *CMD
-----------------------------
LIBGRPPLIB The library to contain the LIBGRPP and LIBGRPA files
used by the tool. The default is QGPL.
SRCLIB The source library of the DDS source. *TAAARC is
the default to access the source from the TAA
Archive. A specific library may also be used if you
have first copied the source from the Archive to
your library. QATTDDS must be the source file name.
EDTLIBGRPD Command parameters *CMD
-----------------------------
LIBGRP The library group to 'position to' when the subfile
is displayed. If left blank, the subfile will be
'positioned to' the first library group in the file.
If the library group does not exist, the subfile
will be 'positioned to' the first library group name
that is less than what was specified.
LIBGRPPLIB The library that contains the LIBGRPP and LIBGRPA
files used by the tool. The default is *LIBL.
*CURLIB may also be used.
CHGLIBGRP Command parameters *CMD
----------------------------
LIBGRP The library groups to be used to replace the entire
user portion of the library list. Up to 10 library
groups may be named. If a library is in more than
one group, only the first occurrence will be used.
The total number of libraries which result after
determining the unique list cannot exceed the system
limit of 250.
RPLCURLIB Whether to replace the current library or not. The
default is *YES. If a current library value is
specified for the first library group named, the
value will be used.
Note that the value specified for the library group
may be *SAME, *CRTDFT, or a named library. If the
value is *SAME, no change occurs to the current
library.
LIBGRPPLIB The library that contains the LIBGRPP and LIBGRPA
files used by the tool. The default is *LIBL.
*CURLIB may also be used.
ADDLIBGRP Command parameters *CMD
----------------------------
LIBGRP The library groups to be used to add libraries to
the user portion of the library list. Up to 10
library groups may be named. If a library is
already on the library list, it is bypassed.
The total number of libraries which result after
determining the unique list cannot exceed the system
limit of 250.
POSITION The position to place the groups. This is a two
part parameter that is similar to the POSITION
parameter on ADDLIBLE.
The first part is the list position. The default is
*FIRST meaning one or more library groups are placed
before any existing libraries on the user portion of
the library list.
*LAST may be specified to place one or more library
groups after any existing libraries on the user
portion of the library list.
*AFTER may be specified to place one or more library
groups after a specified reference library on the
library list.
*BEFORE may be specified to place one or more
library groups before a specified reference library
on the library list.
The second part of the parameter is the reference
library. If the first part is *AFTER or *BEFORE, a
reference library that exists on the library list
must be specified.
If the first part is *FIRST or *LAST, the reference
library must be blank.
LIBGRPPLIB The library that contains the LIBGRPP and LIBGRPA
files used by the tool. The default is *LIBL.
*CURLIB may also be used.
RMVLIBGRP Command parameters *CMD
----------------------------
LIBGRP The library groups to be used to remove libraries
from the user portion of the library list. Up to 10
library groups may be named. If a library is not on
the library list, it is bypassed. No error occurs.
LIBGRPPLIB The library that contains the LIBGRPP and LIBGRPA
files used by the tool. The default is *LIBL.
*CURLIB may also be used.
PRTLIBGRPD Command parameters *CMD
-----------------------------
LIB The library to be checked for. *ALL is the default
and will cause all libraries to be considered.
If a specific library is named, any group containing
the library will be printed. This can assist in
determining all of the library groups that name a
specific library.
CHECK A *YES/*NO value that defaults to *YES to check if
every library specified exists on the system. If
not, the library group and an appropriate error line
are printed.
*NO bypasses the 'existence check' and lets a
listing occur as described in the LIB parameter.
LIBGRPPLIB The library that contains the LIBGRPP and LIBGRPA
files used by the tool. The default is *LIBL.
*CURLIB may also be used.
RTVLIBGRPD Command parameters *CMD
-----------------------------
LIBGRP The library group to be retrieved.
RTNLIBS An optional return variable that will contain the
list of libraries in the library group. Each
library name is 10 bytes long followed by a single
blank making 275 bytes (25 x 11). If specified, the
variable must be declared as *CHAR LEN(275).
CURLIB An optional return variable that will contain the
current library specified for the library group. If
specified, the variable must be declared as *CHAR
LEN(10).
LIBGRPTXT An optional return variable that will contain the
text description provided for the library group. If
specified, the variable must be declared as *CHAR
LEN(50).
LIBGRPPLIB The library that contains the LIBGRPP and LIBGRPA
files used by the tool. The default is *LIBL.
*CURLIB may also be used.
Rules
-----
** EDTLIBGRPD ensures that the libraries named are valid names,
but does not check for existence or authority. The PRTLIBGRPD
command can be used to check existence.
** If a library is on the system portion of the library list when
it is attempted to be added by ADDLIBGRP or CHGLIBGRP, an
error will occur. This error also occurs with the system
commands such as CHGLIBL.
** If a library is on the product portion of the library list, no
conflict occurs with ADDLIBGRP or CHGLIBGRP. This is the same
as the system commands.
** The current library is only changed by the CHGLIBGRP command
and only if the first library group specified on the command
has a current library that is other than *SAME.
** If a library is in more than one group for ADDLIBGRP or
CHGLIBGRP, only the first occurrence will be used.
** If ADDLIBGRP is used and the library already exists on the
library list, no error occurs. The first occurrence is used.
If POSITION(*FIRST) is used, the existing duplicate is
removed. If POSITION(*LAST) is used, the new duplicate is
removed.
** It is not an error for RMVLIBGRP to attempt to remove a
library that is not on the list.
Restrictions
------------
None.
Prerequisites
-------------
The following TAA Tools must be on your system:
CHKNAM Check name
CHKOBJ2 Check object description 2
CPYTAADDS Copy TAA DDS
EDTVAR Edit variable
FILEFDBCK File feedback
HLRMVMSG HLL Remove message
LOCKMSG Lock message
RPGSTSDS RPG status data structure
RTVSYSVAL3 Retrieve system value 3
SNDCOMPMSG Send completion message
SNDESCMSG Send escape message
SNDSTSMSG Send status message
WRTSRC Write source
Implementation
--------------
None, the tool is ready to use, but you must first create the files
used and enter library groups. See the previous discussion.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
CHGLIBGRP *CMD TAALIBT QATTCMD
CRTLIBGRPD *CMD TAALIBT2 QATTCMD
EDTLIBGRPD *CMD TAALIBT3 QATTCMD
PRTLIBGRPD *CMD TAALIBT4 QATTCMD
ADDLIBGRP *CMD TAALIBT5 QATTCMD
RMVLIBGRP *CMD TAALIBT6 QATTCMD
RTVLIBGRPD *CMD TAALIBT7 QATTCMD
TAALIBTC *PGM CLP TAALIBTC QATTCL
TAALIBTC2 *PGM CLP TAALIBTC2 QATTCL
TAALIBTC3 *PGM CLP TAALIBTC3 QATTCL
TAALIBTC4 *PGM CLP TAALIBTC4 QATTCL
TAALIBTC5 *PGM CLP TAALIBTC5 QATTCL
TAALIBTC6 *PGM CLP TAALIBTC6 QATTCL
TAALIBTC7 *PGM CLP TAALIBTC7 QATTCL
TAALIBTC14 *PGM CLP TAALIBTC14 QATTCL
TAALIBTR *PGM RPG TAALIBTR QATTRPG
TAALIBTR3 *PGM RPG TAALIBTR3 QATTRPG
TAALIBTR4 *PGM RPG TAALIBTR4 QATTRPG
TAALIBTR7 *PGM RPG TAALIBTR7 QATTRPG
TAALIBTD *FILE DSPF TAALIBTD QATTDDS
TAALIBTP *FILE PF TAALIBTP QATTDDS
TAALIBTA *FILE LF TAALIBTA QATTDDS
The TAALIBTP source is used for the LIBGRPP file. The TAALIBTA
source is used for the LIBGRPA file.
Structure
---------
CHGLIBGRP Cmd
TAALIBTC CL pgm
TAALIBTR RPG Pgm
CRTLIBGRPD Cmd
TAALIBTC2 CL pgm
EDTLIBGRPD Cmd
TAALIBTC3 CL pgm
TAALIBTR3 RPG Pgm
TAALIBTD Display file
PRTLIBGRPD Cmd
TAALIBTC4 CL pgm
TAALIBTR4 RPG Pgm
TAALIBTC14 CL Pgm
ADDLIBGRP Cmd
TAALIBTC5 CL pgm
TAALIBTR4 RPG Pgm
RMVLIBGRP Cmd
TAALIBTC6 CL pgm
TAALIBTR4 RPG Pgm
RTVLIBGRPD Cmd
TAALIBTC7 CL pgm
TAALIBTR7 RPG Pgm
|