Editor's Note: The is an encore presentation of a great article from years past. An oldie, but a goodie!
You are probably familiar with the Retrieve System Value (RTVSYSVAL) and Retrieve Job Attributes (RTVJOBA) commands. You use them all the time in your CL programs to pull external information that your programs need.
The Retrieve System Data (RTVSYSDTA) command lets you pull lots of system information into your program. The really cool thing about this command is that most of the information retrieved is VERY hard to get at without using a ton of IBM-supplied APIs. RTVSYSDTA takes all the tough work out of finding and getting the information; all you have to do is run his cool command.
Retrieving all return values in one call involves many calls to APIs and MI built-ins, and could take a few seconds to complete on an average system.
Editors Note: For those of you who want to know how to call IBM APIs and MI Built-ins from your RPG IV programs, I encourage you to examine Carsten's source code. Carsten is a brilliant technician and we can all learn a lot from him!
... Dan Riehl
A Reset Statistics parameter is used to refresh the statistics for the return values System ASP percentage used, CPU percentage used, and DB capability percentage used. This works similar to the Reset (F10) function key on the WRKACTJOB and WRKSYSSTS commands.
You can also retrieve processor type, processor group, main storage size, total auxiliary storage size, system ASP size, percentage of system ASP used, ASP threshold percent, CPU used percent, database capability used percent, i5/OS release level, whether the system is currently in restricted state, whether the TCP/IPv4 stack is currently in an operational state, the last IPL date and time, the current IPL type, and the current control panel key lock position.
Additional information is also provided that lets you determine the limits on interactive workload and database workload that can be sustained without causing a disproportionate increase in system overhead.
See the Help Panel group provided to view all the return values for the parameters.
Retrieve System Data (RTVSYSDTA)
Type choices, press Enter.
Reset statistics . . . . . . . . *NO_____ *NO, *YES
CL var for PRCTYPE (4) . . ________ Character value
CL var for PRCGROUP (4) . . ________ Character value
CL var for MAINSTGSIZ (10 0) . . ________ Number
CL var for TOTAUXSTG (10 0) . . ________ Number
CL var for SYSASPSIZ (10 0) . . ________ Number
CL var for SYSASPUSED (7 4) . . ________ Number
CL var for SYSASPTHR (4 1) . . ________ Number
CL var for CPUPCTUSED (4 1) . . ________ Number
CL var for DBCAPUSED (4 1) . . ________ Number
CL var for PRCINTTHR (4 1) . . ________ Number
CL var for PRCINTLMT (4 1) . . ________ Number
CL var for DBCAPTHR (4 1) . . ________ Number
CL var for DBCAPLMT (4 1) . . ________ Number
CL var for OSREL (6) . . ________ Character value
CL var for SYSSTT (1) . . ________ Character value
CL var for TCPSTS (1) . . ________ Character value
CL var for IPLDTS (17) . . ________ Character value
CL var for CURIPLTYP (1) . . ________ Character value
CL var for PNLKEYPOS (6) . . ________ Character value
Carsten has included a sample program that uses the command. The source code for the sample program is included in the downloadable code in CL Source member CBX939T.
The following source code is included:
See each source member for compile instructions.
You can download a zip file containing all the source code from
http://www.iseriesnetwork.com/noderesources/code/clubtechcode/RtvSysDta.zip