News Stay informed about the latest enterprise technology news and product updates.

Controlling ASPs rapid growth -- code

Controlling ASPs rapid growth -- code

Example: DSPJOB OPTION(*RUNA) displays the run attributes for my current interactive job:

 
                           Display Job Run Attributes                       
                                                             System:   S02  
 Job:   KENNETH        User:   KEG            Number:   631282              
                                                                            
 Run priority  . . . . . . . . . . . . . . . . . . :   10                   
 Time slice in milliseconds  . . . . . . . . . . . :   2000                 
 Eligible for purge  . . . . . . . . . . . . . . . :   *YES                 
 Default wait time in seconds  . . . . . . . . . . :   30                   
 Maximum CPU time in milliseconds  . . . . . . . . :   *NOMAX               
   CPU time used . . . . . . . . . . . . . . . . . :     2153               
 Maximum temporary storage in megabytes  . . . . . :   *NOMAX               
   Temporary storage used  . . . . . . . . . . . . :     2                  
 Maximum threads . . . . . . . . . . . . . . . . . :   *NOMAX               
   Threads . . . . . . . . . . . . . . . . . . . . :     1                  

You can see that this job is currently using 2MB of temporary storage. Use
the HELP key to get additional information about this job attribute.

You can also use the QUSRJOBI API to collect this information. Here is a
simple CLP I wrote to do this. This code is designed to notify me when a
single job is using more that 2GB of temporary space. You could modify the
program to set a different threshold. The main thing I want to illustrate is
how to use the API to get at this information. Another note, this program is
called by a different program that builds a list of the jobs I want to
evaluate. 

/* ************************************************************** */
/* PROGRAM DESCRIPTION :                                          */

/*                                                                */
/* RETRIEVE A JOBS TEMP STORAGE USE.                              */
/*                                                                */
/* SPECIAL COMPILE OPTIONS:                                       */
/*                                                                */
/*           WRITTEN BY: KEN GRAAP 03/11/99                       */
/*                                                                */
/*                                                                */
/*                                                                */
/*                                                                */
/* ************************************************************** */
PGM        PARM(&JOB &USER &NUMBER)
/* ************************************************************** */
/*                                                                */
/* DECLARE PROGRAM VARIABLES                                      */
/*                                                                */
/* ************************************************************** */
DCL        &ERRORSW *LGL                     /* Std err */
      DCL        &MSGID *CHAR LEN(7)               /* Std err */
      DCL        &MSGDTA *CHAR LEN(100)            /* Std err */
      DCL        &MSGF *CHAR LEN(10)               /* Std err */
      DCL        &MSGFLIB *CHAR LEN(10)            /* Std err */
      DCL        VAR(&JOBN) TYPE(*CHAR) LEN(26)
DCL        VAR(&JOB) TYPE(*CHAR) LEN(10)
DCL        VAR(&USER) TYPE(*CHAR) LEN(10)
DCL        VAR(&NUMBER) TYPE(*CHAR) LEN(6)
DCL        VAR(&TMPSTG) TYPE(*CHAR) LEN(4)
DCL        VAR(&TMPSTGDEC) TYPE(*DEC) LEN(8 0)
DCL        VAR(&TMPSTGMSG) TYPE(*CHAR) LEN(8)
DCL        VAR(&RECEIVER) TYPE(*CHAR) LEN(124)
DCL        VAR(&LENGTH) TYPE(*CHAR) LEN(4)
DCL        VAR(&ERRLENGTH) TYPE(*CHAR) LEN(4)
/* ************************************************************** */
/*                                                                */
/* GLOBAL MESSAGE MONITOR                                         */
/*                                                                */
/* ************************************************************** */
MONMSG     MSGID(CPF0000) EXEC(GOTO CMDLBL(STDERR1))
/* ************************************************************** */
/*                                                                */
/* DISPLAY THE CURRENT AMOUNT OF TEMP STORAGE USED BY A JOB       */
/* IF MORE THAN 2GB, SEND A MSG VIA THE SHOUT COMMAND             */
/*                                                                */
/* ************************************************************** */
CHGVAR     VAR(&JOBN) VALUE(&JOB *CAT &USER *CAT +
&NUMBER)
CHGVAR     VAR(%BIN(&LENGTH)) VALUE(124)
CHGVAR     VAR(%BIN(&ERRLENGTH)) VALUE(0)
CHGVAR     VAR(%BIN(&TMPSTG)) VALUE(4)
CALL       PGM(QUSRJOBI) PARM(&RECEIVER &LENGTH +
JOBI0150 &JOBN '               '  &ERRLENGTH)
CHGVAR     VAR(&TMPSTG) VALUE(%SST(&RECEIVER 109 4))
CHGVAR     VAR(&TMPSTGDEC) VALUE(%BIN(&TMPSTG 1 4))
IF         COND(&TMPSTGDEC *GT 1999999) THEN(DO)
SHOUT      USERS(KEG KKH) MSG('Job' *BCAT &NUMBER *TCAT +
'/' *TCAT &USER *TCAT '/' *TCAT &JOB +
*BCAT 'is using more than 2GB of +
temporary storage. Please monitor it and +
total aux storage usage closely.')
SNDPGMMSG  MSG('Job' *BCAT &NUMBER *TCAT '/' *TCAT +
&USER *TCAT '/' *TCAT &JOB *BCAT 'is +
using more than 2GB of temporary storage. +
Please monitor it and total aux storage +
usage closely.') TOMSGQ(QGPL/DSPTMPSTG)
ENDDO
CHGVAR     VAR(&TMPSTGMSG) VALUE(&TMPSTGDEC)
SNDPGMMSG  MSG('Job' *BCAT &NUMBER *TCAT '/' *TCAT +
&USER *TCAT '/' *TCAT &JOB *BCAT 'is +
using' *BCAT &TMPSTGMSG *BCAT 'of +
temporary storage') TOMSGQ(QGPL/DSPTMPSTG)
/* ************************************************************** */
/*                                                                */
/* NORMAL END OF PROGRAM                                          */
/*                                                                */
/* ************************************************************** */
END:        RETURN
/* ************************************************************** */
/*                                                                */
/* STANDARD ERROR PROCESSING                                      */
/*                                                                */
/* ************************************************************** */
STDERR1:               /* Standard error handling routine */
            IF         &ERRORSW SNDPGMMSG MSGID(CPF9999) +
                       MSGF(QCPFMSG) MSGTYPE(*ESCAPE) /* Func chk */
            CHGVAR     &ERRORSW '1' /* Set to fail ir error occurs */
STDERR2:    RCVMSG     MSGTYPE(*DIAG) MSGDTA(&MSGDTA) MSGID(&MSGID) +
                         MSGF(&MSGF) MSGFLIB(&MSGFLIB)
            IF         (&MSGID *EQ '       ') GOTO STDERR3
            SNDPGMMSG  MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
                         MSGDTA(&MSGDTA) MSGTYPE(*DIAG)
            GOTO       STDERR2 /* Loop back for addl diagnostics */
STDERR3:    RCVMSG     MSGTYPE(*EXCP) MSGDTA(&MSGDTA) MSGID(&MSGID) +
                         MSGF(&MSGF) MSGFLIB(&MSGFLIB)
            SNDPGMMSG  MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
                         MSGDTA(&MSGDTA) MSGTYPE(*ESCAPE)
            ENDPGM  

Dig Deeper on iSeries programming commands

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close