MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » June 2008

Re: How to retrieve number of jobs in a memory pool?



fixed

I took one of the suggestions and hacked up some code IBM had in the
infocenter.
Yes this loops thru all jobs but ran pretty fast for me:

Bryan

/*
http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=/apis/apiexchnjob.htm*/
/* APIs USED: QUSCRTUS, QUSLJOB, QUSRTVUS, QUSRJOBI */
/* ***************************************************************** */
PGM PARM(&pool)
DCL VAR(&pool) TYPE(*DEC) LEN(15 5)
DCL VAR(&poolnbr) TYPE(*DEC) LEN(5 0)
DCL VAR(&totpool) TYPE(*DEC) LEN(5 0)
DCL VAR(&USRSPC) TYPE(*CHAR) LEN(20) +
VALUE('MEMPOOL QTEMP ')
DCL VAR(&EUSRSPC) TYPE(*CHAR) LEN(10)
DCL VAR(&BIN4) TYPE(*CHAR) LEN(4)
DCL VAR(&LOOP) TYPE(*DEC) LEN(8 0)
DCL VAR(&DEC8) TYPE(*DEC) LEN(8 0)
DCL VAR(&ELEN) TYPE(*DEC) LEN(8 0)
DCL VAR(&ELENB) TYPE(*CHAR) LEN(4)
DCL VAR(&LJOBE) TYPE(*CHAR) LEN(52)
DCL VAR(&INTJOB) TYPE(*CHAR) LEN(16)
DCL VAR(&JOBI) TYPE(*CHAR) LEN(200)
DCL VAR(&poolnbrC) TYPE(*CHAR) LEN(5)
DCL VAR(&NUMBER) TYPE(*CHAR) LEN(6)
DCL VAR(&JOBNAME) TYPE(*CHAR) LEN(26) +
VALUE(' *ALL ')
RTVJOBA NBR(&NUMBER)
CHGVAR VAR(%SST(&USRSPC 5 6)) VALUE(&NUMBER)
CHGVAR VAR(&EUSRSPC) VALUE(%SST(&USRSPC 1 10))
DLTUSRSPC USRSPC(QTEMP/&EUSRSPC)
MONMSG CPF0000
CALL QUSCRTUS (&USRSPC 'COUNTPOOLS' X'00000100' ' ' +
'*ALL ' 'Temp user space')
CHGVAR VAR(%SST(&JOBNAME 1 10)) VALUE('*ALL')
CHGVAR VAR(%SST(&JOBNAME 11 10)) VALUE('*ALL')
CALL QUSLJOB (&USRSPC 'JOBL0100' &JOBNAME '*ACTIVE ')
CALL QUSRTVUS (&USRSPC X'00000085' X'00000004' &BIN4)
CHGVAR &LOOP %BINARY(&BIN4)
IF COND(&LOOP = 0) THEN(GOTO CMDLBL(NOJOBS))
CALL QUSRTVUS (&USRSPC X'00000089' X'00000004' &ELENB)
CHGVAR &ELEN %BINARY(&ELENB)
CALL QUSRTVUS (&USRSPC X'0000007D' X'00000004' &BIN4)
CHGVAR &DEC8 %BINARY(&BIN4)
CHGVAR VAR(&DEC8) VALUE(&DEC8 + 1)
STARTLOOP: IF COND(&LOOP = 0) THEN(GOTO CMDLBL(MSG))
CHGVAR %BINARY(&BIN4) &DEC8
CALL QUSRTVUS (&USRSPC &BIN4 &ELENB &LJOBE)
CHGVAR VAR(&INTJOB) VALUE(%SST(&LJOBE 27 16))
CALL QUSRJOBI (&JOBI X'000000C8' 'JOBI0150' +
'*INT ' &INTJOB)
MONMSG MSGID(CPF3C52) EXEC(GOTO CMDLBL(ENDLOOP))
CHGVAR VAR(&poolnbr) VALUE(%bin(&JOBI 101 4))
IF COND(&POOLNBR = &POOL) THEN(do)
CHGVAR VAR(&TOTPOOL) VALUE(&TOTPOOL + 1)
enddo
ENDLOOP: CHGVAR VAR(&DEC8) VALUE(&DEC8 + &ELEN)
CHGVAR VAR(&LOOP) VALUE(&LOOP - 1)
GOTO CMDLBL(STARTLOOP)
msg: chgvar &poolnbrC &totpool
SNDPGMMSG MSG(&POOLNBRC)
goto alldone

NOJOBS: SNDPGMMSG MSG('No jobs found.')
ALLDONE: DLTUSRSPC USRSPC(QTEMP/&EUSRSPC)
MONMSG CPF0000
ENDPGM


On Mon, Jun 9, 2008 at 5:52 PM, Paul Jackson <paulgjackson@xxxxxxxxx> wrote:

On Sat, Jun 7, 2008 at 6:42 AM, Bryan Dietz <bdietz400@xxxxxxxxx> wrote:
I think that the QUSLJOB API could also be used:

http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=/apis/qusljob.htm

It looks like Key 0307 (Current system pool identifier)
is promising.

Hi Brian,

it appears that that option only allows you to list what appears in
the resultant job list not what is filtered out initially. I guess if
I listed *every* job and then interrogated the pool identifier, that
might work although would be slow.

Thanks for the tip though,
-Paul
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.









Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot COM and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact