ibm-midrangeenvironmentrpgle

How can I read the liblist from within an ILE-Program? (preferably RPG or CL)


We control on what objects our programs on the as400 work, by running them with different liblists. But some operations cannot be directly controlled by this. Therefore, my program needs to read the liblist and decide on some of the libraries in it, how to act.

I could not find any api to read the liblist entries from within a program. What I would expect, is some kind of api that lets me iterate through the liblist entries by priority or gives me an array with them in the order given by the liblist. I'd prefer RPG or CL if possible, but other ILE languages are available, too.

(If you wonder, why I'm trying to do this, I asked another question, that explaines the enclosing problem I'm faced with: How can I create a DTAQ in one of two different libs, controlled by the jobs liblist? But the liblist parsing is an approach to solve that one and is an individual problem).


Solution

  • You can use the QUSRJOBI API to retrieve the library list for a job. You can also use the CL command ADDLIBLE and monitor for error message CPF2103 (library already exists in library list).