iSeries Disk USage

Posted on 2009-07-14
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

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 34

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 250 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

Free camera licenses with purchase of My Cloud NAS

Milestone Arcus software is compatible with thousands of industry-leading cameras for added flexibility. Upon installation on your My Cloud NAS, you will receive two (2) camera licenses already enabled in the software. And for a limited time, get additional camera licenses FREE.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SSH commands for Nas4free 21 370
Best web interface for online storage 3 76
How to check the PVU´s on AIX TSM servers? 3 74
Perc 6/i question adding more drives/arrays 5 46
As the title indicates, I have done this before. It chills me everytime I update the OS on my phone, ( because one time I did this and I essentially had a bricked …
I previously wrote an article addressing the use of UBCD4WIN and SARDU. All are great, but I have always been an advocate of SARDU. Recently it was suggested that I go back and take a look at Easy2Boot in comparison.
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 Micro Tutorial will teach you how to reformat your flash drive. Sometimes your flash drive may have issues carrying files so this will completely restore it to manufacturing settings. Make sure to backup all files before reformatting. This w…

948 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now