Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


iSeries Disk USage

Posted on 2009-07-14
Medium Priority
Last Modified: 2013-12-06
I was wondering if there was a way that I could obtain the disk usage of my iSeries servers via some kind of script. We have over 50 servers and I do not want to have to log into each one of them and do a WRKSYSSTS to figure out how much disk is available.  Is there an easy way around this?
Question by:Matthew Roessner
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 24852148
Hi hfcsp,

WRKSYSSTS or WRKDSKSTS has the OUTPUT parameter customizable. You can generate a spoulefile and configure the 'output' queue to redirect it to an e-mail. So you'll receive the information in your e-mail.

Otherwise, there might be software customizable for that. We use What's up software in here. There's many stuff that we already check. Never tried to go deeper like this. Might be possible.

But my first suggestion could help you... Let me know if you need more info about it.

LVL 35

Expert Comment

by:Gary Patterson
ID: 24853242
Lots of options, but SNMP is probably the best overall.  SNMP will give you much, much more than just disk usage.

SNMP is part of the base OS, and provides a great interface for centralized reporting.  Plus it is an industry standard, and you can use any of thousands of free or commercial utilities and Network Management Systems to query via SNMP and report various information.  If you aren't familiar with SNMP and the associated tools, start with this IBM Redbook (old, but it still applies), and then check out some of the other links.  Note that SNMP grew up in a Unix environment, and most of the best tools are deployed under Unix or Linux, though lots of Windows ports exist, too.

If you manage a lot of servers, routers, and desktopps, you probably already have some sort of NMS in house that you can integrate with.  Ask your LAN/WAN team what they use for network monitoring and management.


You can also use a Management Central System Monitor:  


- Gary Patterson

LVL 27

Accepted Solution

tliotta earned 1000 total points
ID: 24853422

You might be looking for the Retrieve System Status (QWCRSSTS) API. See here for V5R4 docs:


And see the attached for a trivial example of calling the API in CL. The example extracts a few varied items from the API receiver variable -- system ASP size, system ASP percentage used and total auxiliary storage, plus the LPAR number and the number of LPARs along with the extract date/time in CYYMMDDHHMMSS format.

The example simply does a DMPCLPGM at the end to show the extracted values. You'd likely want to replace that command with code to store the extracted values somewhere. You might prefer writing the same function in a HLL that supports database I/O, or you could call this program and pass the extracted values back as return parms.

It should be possible to copy the sample in a CL source member, compile it and run it as is, to see the dumped results. Additional error handling may be necessary.


/* The API parms...                                                 */
/*   For Retrieve System Status...                                  */
   dcl   &sts_DATA    *char  148
   dcl   &sts_LEN     *char    4     value( x'00000094' )
   dcl   &sts_FORMAT  *char    8     value( 'SSTS0200' )
   dcl   &RESET_IND   *char   10     value( '*NO' )
/*   For number of LPARs and LPAR number...                         */
   dcl   &N_LPAR      *dec (   3 0 ) value( 0 )
   dcl   &LPAR_N      *dec (   3 0 ) value( 0 )
/*   For system ASP and total AUX storage...                        */
   dcl   &ASPSIZ      *dec (   9 0 ) value( 0 )
   dcl   &ASPPCT      *dec (   7 4 ) value( 0 )
   dcl   &TOTAUX      *dec (   9 0 ) value( 0 )
/*   For Convert Date & Time...                                     */
   dcl   &CDT_I_FORM  *char   10     value( *DTS )
   dcl   &CDT_I_VAR   *char    8
   dcl   &CDT_O_FORM  *char   10     value( *YMD )
   dcl   &CDT_O_VAR   *char   16
/* And we'll need to specify an errcode receiver at some points...  */
   dcl   &ERRCODE     *char  116     value( x'00000074' )
   dcl   &ERRLEN      *dec (   3 0 ) value( 0 ) /* +
                Will tell us how long any exception data +
                is... */
/* This is a *char version of the date var....                      */
   dcl   &DATTIM      *char   16
   call         QWCRSSTS        ( +
                                  &sts_DATA +
                                  &sts_LEN +
                                  &sts_FORMAT +
                                  &RESET_IND +
                                  &ERRCODE +
   chgvar      &ERRLEN        %bin( &ERRCODE 5 4 )
/* Test for any error...                                            */
   if ( &ERRLEN *gt 0 )  do
      sndpgmmsg  msgid( CPF9898 ) msgf( QCPFMSG ) +
                   msgdta( +
                           %sst(&ERRCODE 9 7) *bcat  +
                           'error exception'  +
                         ) +
                   msgtype( *ESCAPE )
   chgvar      &CDT_I_VAR     %sst( &sts_DATA 9 8 )
   call         QWCCVTDT        ( +
                                  &CDT_I_FORM +
                                  &CDT_I_VAR +
                                  &CDT_O_FORM +
                                  &CDT_O_VAR +
                                  &ERRCODE +
   chgvar      &ERRLEN        %bin( &ERRCODE 5 4 )
/* Test for any error...                                            */
   if ( &ERRLEN *gt 0 )  do
      sndpgmmsg  msgid( CPF9898 ) msgf( QCPFMSG ) +
                   msgdta( +
                           %sst(&ERRCODE 9 7) *bcat  +
                           'error exception'  +
                         ) +
                   msgtype( *ESCAPE )
   chgvar      &DATTIM              &CDT_O_VAR
   chgvar      &N_LPAR        %bin( &sts_DATA 77 4 )
   chgvar      &LPAR_N        %bin( &sts_DATA 81 4 )
   chgvar      &ASPSIZ        %bin( &sts_DATA 49 4 )       /* In MB */
   chgvar      &ASPPCT      ( %bin( &sts_DATA 53 4 ) / 10000 )
   chgvar      &TOTAUX        %bin( &sts_DATA 57 4 )       /* In MB */

Open in new window


Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Concerto Cloud Services, a provider of fully managed private, public and hybrid cloud solutions, announced today it was named to the 20 Coolest Cloud Infrastructure Vendors Of The 2017 Cloud  (http://www.concertocloud.com/about/in-the-news/2017/02/0…
Many businesses neglect disaster recovery and treat it as an after-thought. I can tell you first hand that data will be lost, hard drives die, servers will be hacked, and careless (or malicious) employees can ruin your data.
This video teaches viewers how to encrypt an external drive that requires a password to read and edit the drive. All tasks are done in Disk Utility. Plug in the external drive you wish to encrypt: Make sure all previous data on the drive has been …
This tutorial will walk an individual through the process of installing the necessary services and then configuring a Windows Server 2012 system as an iSCSI target. To install the necessary roles, go to Server Manager, and select Add Roles and Featu…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question