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.
Download the save file containing the source code.