Reader Feedback on Setting Library Lists
June 21, 2006 Joe Hertvik
For my column on How to Set i5 Library Lists for 5250 and Batch Jobs, several readers immediately wrote in to ask questions, provide more information, and even to question why I would cover such a basic topic. Let’s take a look at some of the feedback I received on that column and see what else it teaches us about library lists.
You seemed to indicate that a user program cannot utilize the Product Library list feature in a library list, but I’ve found that you can configure an individual command to create a Product Library list entry whenever that command is executed. This is done when you create or change a command by using either the Create Command (CRTCMD) or Change Command (CHGCMD) commands.
There is a parameter for i5/OS and OS/400 command objects called Product Library (PRDLIB), which is updated by using CRTCMD or CHGCMD. When you run a command with a valid library name in the PRDLIB parameter, i5/OS adds that PRDLIB value as a Product Library list entry into the user’s library list, and that library remains in their library list until the command finishes running. Once the command ends, the library is removed from the list. I frequently use this technique to insert a library into the Product Library list for my utility commands.
This is a cool technique that I tested out by creating a simple command in my shop that uses the UTILLIB library as its product library. I first created the command by using the following CRTCMD command on my i5 partition.
CRTCMD CMD(command_lib/command_name) PGM(program_lib/command_pgm) SRCFILE(source_lib/QCMDSRC) PRDLIB(UTILLIB)
Note that I entered UTILLIB into the Product Library parameter (PRDLIB). This tells i5/OS that when this command starts running, it should insert UTILLIB into a Product List entry for the user’s library list.
Then I ran the command and, while inside the command screens, I performed a system request-3 (Display Job) and took option 13, Display Library List, if active, to view my library list. Sure enough, the UTILLIB library was now added to my library list as a Product Library list entry (type ‘PRD’). Once I exited the command, UTILLIB was removed from the list, which I again verified by taking option 13 inside the Display Job function.
Next, I attempted to change the Product Library list entry for that command to another library named LIB2. I did this by running the following Change Command statement:
CHGCMD CMD(command_lib/command_name) PRDLIB(LIB2)
I then ran the command again and, as advertised, LIB2 was now in the Product Library list instead of UTILLIB. Once I exited the command, LIB2 was removed from my library list.
So the technique works pretty well for allowing your commands to tell i5/OS and OS/400 what product library they need. What I like about it is that it doesn’t junk up your system or user library lists with additional libraries, and it cleans up after itself by removing the product library from your lib list when it’s done. Give it a try. You’ll like it.
One final note on using CRTCMD and CHGCMD to modify library lists. These commands also contain a Current Library parameter (CURLIB) that allows you to change the user’s current library while they execute a command, similar to how you modify Product Library list entries when a command starts. So you can also modify your commands to change their current libraries on the fly.
In your article, you said that “The job’s current library is the first user library in the list.” If the following conditions occur, can you tell me which library is the first library searched in the user part of my library list?
I also understand from your article that the current library is used as the default library for accessed commands and objects that designate *CURLIB as their library value. So which library would be my default *CURLIB value if the user profile designates *CRTDFT as its user profile Current Library parameter?
To take your questions in order, LIB1 would always be the first library searched in the user part of your library list when CURLIB is equal to *CRTDFT. This is because, by default, there is no current library entry specified in a user’s library list when the CURLIB parameter of the user profile contains the *CRTDFT value. To prove this, if you display the library list for a user who has a *CRTDFT Current Library value; that library list will not contain a type ‘CUR’ library entry.
Regarding which library is used for operations that designate *CURLIB as their library value when the user profile contains *CRTDFT in its CURLIB parameter, the QGPL library is always used as the default current library in that situation. So *CURLIB would be set to QGPL for your second question.
It’s interesting that you needed to dedicate an article to Library Lists. I realize that i5/OS newcomers may not be aware of the nitty gritty details of lib lists and that a refresher course is helpful, but the tone of the article seemed aimed at administrators who didn’t know anything about library lists. Has the system slipped so far toward the Dark Side (that is, the PC side) that understanding library lists is now arcane knowledge? Or has the i5 educational process slipped so far that “Library Lists 101” is no longer required reading? Just curious.
I understand your sentiment but, yes, it’s true. There are people who are in charge of i5, iSeries, and AS/400 machines who haven’t had any training on library lists. And worse, I found that there didn’t seem to be any good free primers out there. It seemed that many of the library list articles I found assumed that the readers already knew everything about library lists. Hence, my attempt at a basic library list article, which was aimed at a knowledgeable system administrator who didn’t grow up in an OS/400 and i5 environment. While it might not be your cup of tea, it’s my hope that there are some people who can benefit from it.