Published on System iNetwork (http://systeminetwork.com)
APIs by Example: Open List of Jobs (QGYOLJOB)
By tzura
Created Jun 19 2003 - 04:00

This week's API by Example from Carsten Flensburg provides a sample program showing how to use the QRYOLJOB API to fetch the CPU usage for all active jobs. For each job using more than 50 percent of the available interactive processor resources, the program sends a message to the message queue of the user currently running the CPU-intensive program.

The sample RPG IV program uses the following APIs:

Open List of Jobs (QGYOLJOB)
This API generates a list of jobs on the system based on specified selection criteria.
http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/apis/qgyoljob.htm [1]

Retrieve Call Stack (QWVRCSTK)
QWVRCSTK returns the call stack information for the specified thread.
http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/apis/qwvrcstk.htm [2]

Send Nonprogram Message (QMHSNDM)
This API sends a message to a nonprogram message queue so your program can communicate with another job or user.
http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/apis/QMHSNDM.htm [3]

Get List Entries (QGYGTLE)
QGYGTLE allows requests to get entries from previously opened lists on the iSeries server. A list will exist if an initial request has already been made and the list was not closed using the Close List (QGYCLST) API.
http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/apis/qgygtle.htm [4]

Close List (QGYCLST)
This closes a previously opened list.
http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/apis/qgyclst.htm [5]

Materialize Resource Management Data (MATRMD)
This API materializes the resource management data.
http://publib.boulder.ibm.com/iseries/v5r2/ic2924/books/sm18/c0924180.pdf [6]

Copy Bytes (MEMMOVE)
MEMMOVE copies count bytes of src to dest. This function allows copying between objects that may overlap as if src is first copied into a temporary array.
http://publib.boulder.ibm.com/iseries/v5r2/ic2924/books/c4156071.pdf [7]

sleep(), Suspend Processing for Interval of Time
This suspends a thread for a specified number of seconds.
http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/apis/sigsleep.htm [8]

You can obtain the RPG IV program at
http://www.iseriesnetwork.com/noderesources/code/clubtechcode/LstCPUHogs.zip [9].

The above source code was written by Carsten Flensburg. For questions regarding this tip, contact Carsten at mailto:flensburg@novasol.dk [10].

© 2010 Penton Media, Inc.

Source URL: http://systeminetwork.com/node/61206

Links:
[1] http://systeminetwork.com/
[2] http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/apis/qwvrcstk.htm
[3] http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/apis/QMHSNDM.htm
[4] http://systeminetwork.com/
[5] http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/apis/qgyclst.htm
[6] http://publib.boulder.ibm.com/iseries/v5r2/ic2924/books/sm18/c0924180.pdf
[7] http://publib.boulder.ibm.com/iseries/v5r2/ic2924/books/c4156071.pdf
[8] http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/apis/sigsleep.htm
[9] http://www.iseriesnetwork.com/noderesources/code/clubtechcode/LstCPUHogs.zip
[10] mailto:flensburg@novasol.dk