Midrange News for the IBM i Community

Posted by: Bob Cozzi
Rogue Programmer
Cozzi Productions, Inc.
Save Restore Library List
has no ratings.
Published: 18 May 2012
Revised: 23 Jan 2013 - 4055 days ago
Last viewed on: 01 Mar 2024 (5811 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

Save Restore Library List Published by: Bob Cozzi on 18 May 2012 view comments(3)

I've added two new commands to COZTOOLS:

  1. SAVLIBL - Save the library list entries to a save area
  2. RSTLIBL - Restore the library from a library list saved to the save area

They work like a PUSH and POP process (if you're familiar with those IT terms).

Basically every time you save a library list it is added to the library list save area.

Then when you run the RSTLIBL command, the last entry from the save area is restored (your job's library is changed to that saved library list) and the saved library list is removed from the save area.

This allows you to use SAVLIBL, call an application program, and then upon exiting from that program, run the RSTLIBL to return your library list to what it was before calling the application program.

Or you can run SAVLIBL, SAVLIBL, SAVLIBL, followed by one or more RSTLIBL commands and progressively restore the library list based on ever changing conditions.

Likewise you can use the RSTLIBL RMV(*NO) parameter to restore the library list, and keep the saved library list "active" so that the next RSTLIBL will retrieve the same saved library list as the previous RSTLIBL RMV(*NO) command.

So the question is, do these two commands seem at all useful in your shop? I know in at least two clients, they are constantly entering applications that screw up their library list in order to run the app, and then never restore the library list when they exit that same app.

The SAVLIBL command can be run before entering those types of apps, and then the RSTLIBL can be issued upon returning to reset the library list to what it "should" be.

Return to midrangenews.com home page.
Sort Ascend | Descend


(Sign in to Post a Comment)
Posted by: neilrh
Premium member *
Jackson, MI
Comment on: Save Restore Library List
Posted: 11 years 9 months 14 days 1 hours 6 minutes ago

I remember back in the early 90's one of my colleagues wrote these commands, with a 3rd command: RPLLIBL - this calls a successive SAVLIBL, CHGLIBL.

Posted by: DaleB
Premium member *
Reading, PA
Comment on: Save Restore Library List
Posted: 11 years 9 months 13 days 22 hours 18 minutes ago

That does sound useful. I have code here and there that does this, but coded in each program, not a common routine.

Posted by: bobcozzi
Site Admin ****
Comment on: Save Restore Library List
Posted: 11 years 9 months 12 days 2 hours 39 minutes ago
Edited: Sun, 20 May, 2012 at 08:47:15 (4303 days ago)

Neil,  RPLLIBL (Replace Library List) was the old S/38 name for CHGLIBL. Do you mean his version of RPLLIBL did a save followed by a change libl, so that you could then do a "restore" LIBL? Something like this:


... do some stuff

RSTLIBL  /* Returns libl to where it was prior to RPLLIBL */

Is this what you meant?