In this installment of APIs by Example, Carsten Flensburg has provided a sample program, command, and help panel that demonstrate the Open List of Job Queues (QSPOLJBQ) API.
In V5R2 and earlier releases, the “Open List APIs” are part of an optional component of the operating system called “OS/400 — Host Servers.” This component, which is installed in library QGY, is product option 12 on the Install Licensed Program screen. In V5R3, these APIs were moved to the base operating system, are installed in library QSYS, and do not have to be installed separately.
The Open List APIs are similar to other APIs, but they have additional sorting and filtering capabilities and do not rely on user spaces to return large lists of data. Instead, the API returns the first entry of the list and a handle that you can pass to the Get List Entries (QGYGTLE) API to get more entries.
In this example, QSPOLJBQ is called in order to get a list of job queues. That means that each entry of the list represents one job queue on the system. The call to this API returns the first job queue as well as a handle. Then the program enters a loop that will retrieve the rest of the job queues by passing the handle to QGYGTLE. Finally, the Close List (QGYCLST) API is called to tell the system that the program is done using the list.