The Change Product Library command changes one or both of the
libraries in the Product Library positions of the library list.
A typical command to ensure that LIB1 is on the library list for most
typical functions would be:
CHGPRDLIB PRDLIB1(LIB1) PRDLIB2(LIB1)
Note that the same library is placed in both positions. It does not
have to be the same library, but this is the recommended solution for
adding a single library to the Product Library portion of the library
list. See the later explanation for why this is recommended.
You must be authorized to the TAAPRDLIB authorization list to use the
command. The Security Officer can make the command available for
public use by authorizing the *PUBLIC profile to *USE of the
authorization list.
There is a separate TAA Tool RTVPRDLIB which will allow you to
retrieve the current values. Good programming practice would be to
retrieve the current values and then reset them when your function is
complete. See the example, with the RTVPRDLIB Tool documentation.
CHGPRDLIB uses the QLICHGLL API to replace the current values. The
other parts of the library list remain unchanged.
How the system handles the Product Libraries
--------------------------------------------
The library list is made up of several portions:
- System portion
- Product library portion
- Current library
- User portion
The Product library portion allows for two libraries. From a
discussion viewpoint, they are known as the first (PRDLIB1) and
second (PRDLIB2) Product libraries.
When a command is run that has specified the PRDLIB parameter on
CRT/CHGCMD, the system saves the first product library and
substitutes the library specified for the PRDLIB parameter. When the
command completes, the system swaps back the saved library. Note
that the 'swap' is done by the system and not by the CPP (Command
Processing Program).
The system commands are designed not to change the Product Library
positions (The author is not aware of any system commands that do
so). A command such as DSPJOBD specifies PRDLIB(*NOCHG).
Products like RPG use the Product Library positions. For example,
CRTRPGPGM specifies PRDLIB(QRPG). When the command is run, the
system saves the first product library and replaces it with QRPG.
When CRTRPGPGM completes, the saved value is returned.
The CHGPRDLIB command is specified as PRDLIB(*NOCHG). It also
specifies that the processing program is in TAATOOL.
All other TAATOOL commands are all specified as PRDLIB(TAATOOL).
This allows a separate library of just the TAA Tool commands to exist
on the library list and the CPPs to be in a separate library.
SEU is a special case (The only one the author is aware of). When
STRSEU is run, the PRDLIB1 value becomes QPDA. If a syntax checker
is needed for a source type of CLP, the syntax checker is in QSYS and
no change occurs to PRDLIB2. If a Product syntax checker is needed,
the Product library is swapped into the PRDLIB2 position. For
example, if you request a source type of RPG, QRPG is swapped into
the PRDLIB2 position after the file is found.
Because of this technique, the following would occur if you have a
source file in a library that you want to use as a Product Library
with SEU (the STRSEU command).
** If you have only replaced PRDLIB1 with your library, the
system swaps out the PRDLIB1 value and uses QPDA.
Consequently, your file could not be found by using the
library list.
** If you have replaced PRDLIB2 with your library, the system
swaps the first Product Library with QPDA, but SEU can still
find your file because the library is in the PRDLIB2 position.
When SEU needs a specific syntax checker like RPG, it swaps
the QRPG library into PRDLIB2. Because SEU has already found
your file, the system performs as you would want it to even
though the library with your file is no longer on the library
list.
The only unnatural function you will see, is if you attempt to
use the SEU command entry function (F21) to access an object
in your Product Library by using the library list. It would
not be found. You would have to library qualify the object.
Just before SEU ends, SEU swaps back the PRDLIB2 saved value. When
SEU does end, the system swaps back the saved PRDLIB1 value.
The PDM menu operates in a similar manner.
Menu object types have a similar capability as command definition
objects. CRTMNU supports the PRDLIB parameter which works in a
manner similar to commands.
The system does not have special areas for each Product Library. It
only has a list. Consequently if you specify:
CHGPRDLIB PRDLIB1(*NONE) PRDLIB2(LIBA)
the system will move LIBA to the top of the Product Library portion
of the library list.
Or if there was no PRDLIB1 library and you specified:
CHGPRDLIB PRDLIB1(*SAME) PRDLIB2(LIBA)
the system will moves LIBA to the top of the list (the first
library).
If you use RTVPRDLIB, you will receive the first library in the
PRDLIB1 return parameter. In either of the previous two examples,
you would receive PRDLIB1 even though you had specified it as
PRDLIB2.
If you specify:
CHGPRDLIB PRDLIB1(*NONE) PRDLIB2(LIBA)
CHGPRDLIB PRDLIB1(*SAME) PRDLIB2(LIBB)
because the system places LIBA at the top of the list, the result of
both commands would be to have both LIBA and LIBB as the Product
Libraries.
The recommended solution for placing a single library in the Product
Library list is:
CHGPRDLIB PRDLIB1(LIBA) PRDLIB(LIBA)
Because the CHGPRDLIB specifies PRDLIB(*NOCHG), TAATOOL is not
swapped in. However, other TAA Tool commands do specify
PRDLIB(TAATOOL).
Specifying the same library in both positions ensures that normal
system and Product functions will retain at least one of the LIBA
values on the list.
Unless you are already using the QLICHGLL API (or one of your
products is), the CHGPRDLIB command can offer a good solution for
retaining a standard library on your library list.
For example, if you default to place the TAA Tool commands in the
TAATOOL library, you can place TAATOOL into the Product Library
portion. Or if you place the TAA Tool commands in a separate library
(e.g. TAACMD), you can place TAACMD into the Product Library
portion.
RPLLIBL or CHGLIBL do not impact the two Product Libraries. If your
applications use RPLLIBL to change the library list and do not reset
it, retaining a library on the library list can be difficult.
There are no significant restrictions relative to using the Product
libraries (the library name must be valid).
It is not an error to do one of the following:
** Use a library that is already on the system portion of the
library list.
** Use a library that is already on the user portion of the
library list.
** Use a library that is also the current library.
** Use the same library name that already exists in one of the
other Product library positions.
** Use the same library in both PRDLIB1 and PRDLIB2. In fact,
this is the recommended solution.
Command parameters *CMD
------------------
PRDLIB1 The library to be placed into the Product Library
nbr 1 position of the library list.
The special value *NONE may be used to specify that
no library should exist. Note the previous
discussion about what occurs to the library in
PRDLIB2 on this command or already exists as the
second product library.
The special value *SAME may be used to specify that
no change occur.
PRDLIB2 The library to be placed into the Product Library
nbr 2 position of the library list. Note the
previous discussion about what happens if
PRDLIB1(*NONE) is specified or there is no library
that exists for the first product library.
The special value *NONE may be used to specify that
no library should exist.
The special value *SAME may be used to specify that
no change occur.
Restrictions
------------
Note the previous discussion of how the system handles the Product
portion of the library list.
Prerequisites
-------------
The following TAA Tools must be on your system:
RTVPRDLIB Retrieve product library
SNDCOMPMSG Send completion message.
Implementation
--------------
The tool is ready to use, but the user must be authorized to the
TAAPRDLIB authorization list. The Security Officer can set the
public authority to *USE if you are willing to allow any user to run
CHGPRDLIB.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
CHGPRDLIB *CMD TAALIBN QATTCMD
TAALIBNC *PGM CLP TAALIBNC QATTCL
|