midrange.com code scratchpad
Name:
system status used %
Scriptlanguage:
Plain Text
Tabwidth:
4
Date:
11/09/2017 10:20:20 pm
IP:
Logged
Description:
calculate the used disk space and temporary space used.
Code:
  1. /*    Here is a quick way to see the percent used of ASP1.          */                              
  2. /*    The API used is QWCRSSTS.                                     */                              
  3. /*                                                                  */                              
  4. /*  SYSTNAME system ASP disk is 00.0000% used. Total # of jobs is 0000000   */                      
  5. /*        comments to bryandietz@yahoo.com                          */                              
  6. /*                                                                  */                              
  7. /* From the Current unprotect used field, determine what percent of the system is comprised of */   
  8. /* current temporary space allocation through the following formula: % of temp space consuming */   
  9. /* system storage = (Current unprotect used in M bytes / Total ASP in G bytes) / 10. For the above*/
  10. /* example this would be (710 / 20.97) / 10 = 3.4%                  */                              
  11. /*                                                                  */                              
  12. /*                                                                  */                              
  13. /*                                                                  */                              
  14. /*                                                                  */                              
  15.                                                                                                     
  16.      PGM                                                                                            
  17.      DCL VAR(&sys) TYPE(*CHAR) LEN(8)                                                               
  18.      DCL VAR(&PCT) TYPE(*CHAR) LEN(7)                                                               
  19.      DCL VAR(&tjob) TYPE(*CHAR) LEN(7)                                                              
  20.       DCL VAR(&tmpsc) TYPE(*CHAR) LEN(7)                                      
  21.       DCL VAR(&RCVDTA) TYPE(*CHAR) LEN(099)                                   
  22.       DCL VAR(&RCVLEN) TYPE(*int) value(99)                                   
  23.       DCL VAR(&RESETO) TYPE(*CHAR) LEN(10) VALUE('*YES      ')                
  24.       DCL VAR(&FMTNAM) TYPE(*CHAR) LEN(08) VALUE('SSTS0200')                  
  25.       DCL VAR(&ERRSTS) TYPE(*CHAR) LEN(08) VALUE(X'00000000')                 
  26.       DCL VAR(&PCTASP) TYPE(*DEC) LEN(7) VALUE(0)                             
  27.       DCL VAR(&PCTX) TYPE(*DEC) LEN(7 4) VALUE(0)                             
  28.       DCL VAR(&auxstg) TYPE(*int) LEN(4) VALUE(0)                             
  29.       DCL VAR(&cusu) TYPE(*int) LEN(4) VALUE(0)                               
  30.       DCL VAR(&tmps) TYPE(*DEC) LEN(7 4) VALUE(0)                             
  31.                                                                               
  32.       RTVNETA    LCLCPNAME(&SYS)                                              
  33.       CALL PGM(QWCRSSTS) PARM(&RCVDTA &RCVLEN &FMTNAM &RESETO &ERRSTS)        
  34.       CHGVAR VAR(&PCTASP) VALUE(%BIN(&RCVDTA 53 4))                           
  35.       CHGVAR VAR(&auxstg) VALUE(%BIN(&RCVDTA 57 4))                           
  36.       CHGVAR VAR(&cusu  ) VALUE(%BIN(&RCVDTA 61 4))                           
  37.       CHGVAR VAR(&PCTX) VALUE(&PCTASP / 10000)                                
  38.       CHGVAR VAR(&tmps) VALUE((&cusu / (&auxstg / 1000)) / 10)                
  39.       CHGVAR VAR(&PCT) VALUE(&PCTX)                                           
  40.       CHGVAR VAR(&tmpsc) VALUE(&tmps)                                            
  41.               SNDPGMMSG  MSGID(CPF9897) MSGF(QCPFMSG) MSGDTA(&SYS +              
  42.                            *BCAT 'Sys ASP: ' || &PCT *TCAT +                     
  43.                            '% used' ||  +                                        
  44.                            '. Temp stg: ' || &tmpsc *TCAT '% of total disk.')    
  45.       ENDPGM                                                                     
  46.  
© 2004-2019 by midrange.com generated in 0.007s valid xhtml & css