Swap/Restore Library Lists Directory
Directory .ZIP
objects?
- WARNING:
- These functions have NOT been updated to work with the expanded library lists available with V5R1. Check back for updates. And "Thanks!" to John Snyder for reminding me.)
These items include SWPLIBL (Swap Library List) and RSTLIBL (Restore Library List) commands. These are used to change the library list of the current job to some other library list and later restore the original *libl. I use these commands when resolving problems from end-users or developers. By temporarily swapping to their current *libl, I'm more likely to be duplicating their actual environment. RSTLIBL gets me back to my original *libl easily.
The swapped-in *libl can be from another job on the system, from a named *jobd or from whatever *libl is indicated on another user's *usrprf. *Libls can be swapped in one after the other, creating a "stack" of *libls; the current job's *libl can be restored to its original state directly or the list of *libls can be "popped" one at a time off of the stack until the original *libl is eventually restored.
The "stack" is implemented as a user index with two types of entries. The first entry type is the header; this entry contains the current stack level. The second entry type contains each *libl as they are placed on the stack. Each time a *libl is restored, the *usridx header entry is retrieved to get the current stack counter and that counter is used to build the *usridx key to locate the *libl entry we want to restore to. After the restore, the highest entry on the stack is removed and the header is updated.
Please read the @GENERAL DISCLAIMER document for any items you should be aware of if you download any of these items.
CLPs
RSTLIBL -- Restore *Libl:
This program is the CPP for RSTLIBL. The program either *POPs to the previous *libl or restores the job's *ORIGINAL *libl, depending on the action requested. The restored *libl comes from the first entry on the stack or the one pointed to by the header entry, depending on whether the request is *ORIGINAL or *POP.RTNJOBDILL -- Return *Jobd INLLIBL():
This program is the CPP for RTNJOBDILL. The program extracts the INLLIBL() from a named *jobd and returns it to the calling program. The returned *libl is not space-delimited.SLTJOB -- Select Job:
This program is the CPP for SLTJOB. This program controls selection of a specific job from a list of jobs based on selection criteria. The list is built into a *usrspc and the JOBCHSR program is called to display the list and return the selected job name.SWPLIBL -- Swap *Libl:
This program is the CPP for SWPLIBL. The program issues a CHGLIBL command to change the current job's *libl to a *libl from another job, from a named *jobd or from a *libl indicated for a named *usrprf. The job's current *libl is stored in a *usridx for later use by a possible RSTLIBL.
CMDs
RSTLIBL -- Restore *Libl:
The command definition object source for RSTLIBL. This command accepts a single parameter that determines whether the previous (*POP) or the original (*ORIGINAL) *libl for this job will be restored.RTNJOBDILL -- Return *Jobd INLLIBL():
The command definition object source for RTNJOBDILL. This command accepts a parameter naming a *jobd and returns the INLLIBL().RTVJOBD -- Retrieve Job Description Information (QWDRJOBD):
The command definition object source for QWDRJOBD. This command accepts a parameter specifying a *jobd and returns the first 1000 bytes of the JOBD0100 format from the Retrieve Job Description Information (QWDRJOBD) API as a data structure in a CL variable. Individual attributes can then be parsed out.SLTJOB -- Select Job:
The command definition object source for SLTJOB. This command accepts parameters specifying generic or partial job name, status and/or type and returns the selected job name.A list of jobs matching the selection criteria is built into a *usrspc. The ILE RPG program JOBCHSR is called to display the list into a windowed subfile and allow selection. The name of the selected job is returned.
SWPLIBL -- Swap *Libl:
The command definition object source for SWPLIBL. This command accepts parameters naming a job, a *jobd or a *usrprf. The *libl associated with whichever is specified is returned.
DDSs
JOBCHSR -- Job-chooser Window Subfile:
This DSPF is a windowed subfile that will contain a list of job names. A selection column allows the user to select a job name from the list.
RPGLEs
JOBCHSR -- Job Chooser:
This program retrieves job name entries from a *usrspc filled by the LUSJOB command (or the List Job (QUSLJOB) API), displays the names in a subfile, reads the selected subfile entry and returns the selected name to the caller.