Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CPU time and ELAPSED TIME FOR A JOB WITH REXX

1,195 views
Skip to first unread message

Jay Pillai

unread,
Nov 24, 2000, 3:00:00 AM11/24/00
to
Can somebody help me with a REXX program. I would like to find the CPUtime
of a job and the elapsed time. Is it
possible to do this with a rexx program. I want to inlcude this program as
the last step in my JCL and this step should give me the
CPU time, elapsed time etc.. for the job in which this step is included.


Thank you in advance

Jay

Brian Penn

unread,
Nov 24, 2000, 3:00:00 AM11/24/00
to
Hi Jay,
You could try this. I hope it helps.
/*--- REXX --------------------------------------------------------*/
/* */
/* SYSVAR(SYSCPU) returns CPU time to nearest hundredth of a second */
/* TIME(R) Resets the elapsed time counter. */
/* TIME(E) Reports elapsed time since the previous reset. */
/*--------------------------------------------------------------------*/
cpu_seconds = sysvar(syscpu) /* CPU time used by TSO session so far. */
z = time(R) /* Reset Elapsed time counter */

/* ....

Other code ...

...*/

elapsed_seconds = Time(E)
cpu_seconds = Sysvar(SYSCPU)-cpu_seconds

Say 'This REXX has used' cpu_seconds 'CPU-Seconds.' ,
'and' elapsed_seconds 'elapsed Seconds'
Exit 0


Thank you in advance

Jay


--------------------------------------------------------------------------------
This email and any files transmitted with it are intended solely for the
addressee(s) and may be legally privileged and/or confidential. If you have
received this email in error please destroy it and contact the sender, via
our switchboard on +44 (0)20 7623 8000 or via return e-mail. You should not
copy, forward or use the contents, attachments or information in any way.
Any unauthorised use or disclosure may be unlawful. Dresdner Kleinwort
Benson gives no warranty as to the accuracy or completeness of this email
after it is sent over the Internet and accepts no responsibility for changes
made after it was sent. Any opinion expressed in this email may be personal
to the author and may not necessarily reflect the opinions of the Bank or
its affiliates. They may also be subject to change without notice.
--------------------------------------------------------------------------------

Shimon Cohen

unread,
Nov 24, 2000, 3:00:00 AM11/24/00
to
But the rexx have to sum up all the cpu usage of previous steps in the
job. (and maybe subtruct its own).

shimon.

--
+---------------------------------+
| Shimon Cohen |
| shi...@netvision.net.il |
+---------------------------------+

One Hand Clapping

unread,
Nov 25, 2000, 3:00:00 AM11/25/00
to
yes, but it is not easy, requires accessing swa memory control blocks, and may
not be portable across some operating system releases... carefull analysis of
the JMR, mvs JCT, LCT et. al. will show you what you need to do. I forget if
the step information is added into the JMR/JCT or if you have to step thru
something for each step...

Jay Pillai wrote:

> Can somebody help me with a REXX program. I would like to find the CPUtime
> of a job and the elapsed time. Is it
> possible to do this with a rexx program. I want to inlcude this program as
> the last step in my JCL and this step should give me the
> CPU time, elapsed time etc.. for the job in which this step is included.
>

One Hand Clapping

unread,
Nov 27, 2000, 3:00:00 AM11/27/00
to
I mis-remembered myself on this.... ascbejst contains the total cpu time for all
prior steps.
Simply reference the ascb from psaaold and there you have it. Here is how I
format this
in assembler....

C R0,=F'8' . IS THIS WAIT TIME?
BE DOWAIT1 . YES GO FORMAT WAIT TIME
LM R14,R15,ASCBEJST-ASCB(R9) TCTEJST JOB TIME
SRDA R14,12 . SHIFT UNUSED BITS
D R14,=F'10000' . R15=SSSSSS.TH
A R15,WORK . ADD IN PRIOR STEPS CPU TIME
LR R14,R15 . GO AND DROP OFF THE "H"
SRDA R14,32 . SHIFT FOR DIVIDE
D R14,=F'10' . R15=SSSSSS.T
ST R15,CPUTIME . STORE CPU TIME

One Hand Clapping wrote:

> yes, <snip>


Brian Penn

unread,
Nov 27, 2000, 3:00:00 AM11/27/00
to
It's not really possible (no, sorry. It is possible, but not
sensible and certainly not elegant) to do this with a REXX.
The best (only?) way to get the timings for the complete JOB
is to use the SMF exit IEFACTRT. See "MVS System Management Facilities"
for more about SMF exits. An example is on file 109 of the CBT tape.
http://www.cbttape.org/cbtdowns.htm file#109.

Cheers,
Brian.

shimon.

> Can somebody help me with a REXX program. I would like to find the
CPUtime
> of a job and the elapsed time. Is it
> possible to do this with a rexx program. I want to inlcude this program as
> the last step in my JCL and this step should give me the
> CPU time, elapsed time etc.. for the job in which this step is
included.
>

--


+---------------------------------+
| Shimon Cohen |
| shi...@netvision.net.il |
+---------------------------------+

Jay Pillai

unread,
Nov 27, 2000, 3:00:00 AM11/27/00
to
I found a good solution by Bob Stark in The TSO-REXX Archives. He gets this
information from RMF . It is very fast, but I could'nt
quite figure out how to get the CPU time for a particular job from this
code.
Any one out there, who could help me to get this information from this
code.
---------------------------------------------------------------------------
---------------------------------------------------------------------------
---------
Here is the code from Bob Stark

/* REXX exec to call ERBSMFI to extract the in-storage SMF record */
one = '00000001'X
smf_rectype = RIGHT(D2C(79),4,'00'X)
smf_subtype = RIGHT(D2C(2),4,'00'X)
buffer = COPIES('00'x,32767)COPIES('00'x,32767)COPIES('00'x,32767)
buffer = buffer''COPIES('00'x,32767)COPIES('00'x,32767)
bufflen = RIGHT(D2C(LENGTH(buffer)),4,'00'X)
cpu_util = '00000000'X
pagerate = '00000000'X
CALL showhex 'one'
CALL showhex 'smf_rectype'
CALL showhex 'bufflen'
/*--------------------------------------------------------------------*/
/* ADDRESS LINKPGM must be used, because it generates a list of */
/* fullword pointers to the value of each parm, with the '80'x bit on */
/* '80'x bit on in the last pointer in the list. */
/*--------------------------------------------------------------------*/
ADDRESS LINKPGM 'ERBSMFI one smf_rectype smf_subtype buffer bufflen',
'cpu_util pagerate'
SAY 'RC='RC
say 'cpu_util='C2D(cpu_util)
say 'pagerate='C2D(pagerate)
CALL DUMP LEFT(buffer,512)
EXIT: EXIT

DUMP:
ARG _dmpinput

DO _dmpi = 0 BY 16 WHILE _dmpinput <> ''
PARSE VAR _dmpinput 1 _dmpline 17 _dmpinput
_dmphexline = C2X(_dmpline)
_dmpcharline = TRANSLATE(_dmpline,,XRANGE('00'x,'3F'x),'.')
SAY RIGHT(D2X(_dmpi),3),
SUBSTR(LEFT(_dmphexline,32),1,8) SUBSTR(LEFT(_dmphexline,32),9,8),
SUBSTR(LEFT(_dmphexline,32),17,8) SUBSTR(LEFT(_dmphexline,32),25,8),
_dmpcharline
END
RETURN

SHOWHEX:
arg var
SAY RIGHT(var,12) VALUE(var)' length('var')='LENGTH(VALUE(var)),
'hex:'C2X(VALUE(var))
RETURN

Bob Stark [ProTech - When you're serious about Systems Management]
www.protechpts.com

---------------------------------------------------------------------------
---------------------------------------------------------------------------
----------------------------------------------


Jay

One Hand Clapping

unread,
Nov 27, 2000, 3:00:00 AM11/27/00
to
there it is.... but I am not sure if this if only for the current measurement
interval or not...

Jay Pillai wrote:

> <snip>but I could'nt quite figure out how to get the CPU time for a


> particular job from this code. Any one out there, who could help me to get
> this information from this

> code. <snip>

> say 'cpu_util='C2D(cpu_util)

snip


Paul Liao

unread,
Nov 28, 2000, 3:00:00 AM11/28/00
to
Using Bob Stark's code I modified it a bit. Maybe this can give you
something to go on. This code has been tested on OS/390 2.8 and 2.10 and
it's like RMF's ARD report. RMF Data section may change in other releases.
Please refer to MVS System Management Facilities (SMF) Record Type 79
(subtype 2) ARD Data Section for detail. Have fun..

/* Rexx*/
/* Display Address Space Resource Data using RMF API */
/* Like RMF Monitor II ARD Report */
/* Requirement: RMF. */
/* Platform: TSO OS/390 2.8 and 2.10 */

numeric digits 16 /* 31 bit addressing or 2w */
cvt =c2d(storage(10,4)) /* CVT Ptr */
asvt =c2d(storage(d2x(cvt+556),4)) /* ASVT */
asvtmaxu=c2d(storage(d2x(asvt+516),4)) /* ASVT Max users. */
fullwd='00000000'x
one ='00000003'X
smf_rectype ='0000004F'x /* SMF 79 */
smf_subtype ='00000002'x /* Subtype 2 */
buffer = copies('00'x,176*asvtmaxu) || copies('00'x,400)


bufflen = RIGHT(D2C(LENGTH(buffer)),4,'00'X)
cpu_util = '00000000'X
pagerate = '00000000'X

srm = '00000000'X
m=0

ADDRESS attchpgm 'ERBSMFI one smf_rectype smf_subtype buffer bufflen',
'cpu_util pagerate fullwd srm'
if rc\=0 then do
if rc=16 then say "No data available. Rc="rc
else say "RMF API encountered unexpected Return code. Rc="rc
exit 12
end
/* Heading */
h.1=Time() " SMF79-2 RMFARD Address Space Resource Data ",
date('u')
h.2="ASid Jobname Pos Type Total-CPU Total-Elasp Total-SRM"
h.3="------------------------------------------------------------"||,
"-------------------"
say h.1;say h.2;say h.3

parse var buffer smfheader 'ARD ' . +100 smfbuffer

do while smfbuffer\='' & (m<asvtmaxu)
m=m+1
parse var smfbuffer 1 smfdata +176 smfbuffer
if smfdata==copies('00'x,176) then leave
parse var smfdata 1 asid +2 ,
3 jobname +8 ,
15 cl +2 ,
17 TAS +2 ,
35 TCPU +4 ,
47 EJST +4 ,
51 TSRM +4 ,
55 Csai +4 ,
59 EXCP +2 ,
137 scl +8 ,
155 Rgrp +8 ,
159 tcpc +4 .
asid=c2x(asid)
tas=c2x(tas)
jtype='STC '
if tas='0000' then jtype='JOB '
if tas='0002' then jtype='MNT '
if tas='0003' then jtype='TSO '
if tas='0004' then jtype='ASCH'
if tas='0005' then jtype='OMVS'
tcpu=format(c2d(tcpu),12)
ejst=format(c2d(ejst),12)
tsrm=format(c2d(tsrm),12)
excp=c2x(excp)
list=asid jobname cl' 'jtype tcpu ejst tsrm
say list
end
exit 0

----------
> From: Jay Pillai <Jay_P...@SWISSRE.COM>


> To: TSO-...@VM.MARIST.EDU
> Subject: CPU time and ELAPSED TIME FOR A JOB WITH REXX

> Date: Monday, November 27, 2000 11:08 AM


>
> I found a good solution by Bob Stark in The TSO-REXX Archives. He gets
this

> information from RMF . It is very fast, but I could'nt


> quite figure out how to get the CPU time for a particular job from this
> code.
> Any one out there, who could help me to get this information from this
> code.
>

---------------------------------------------------------------------------

0 new messages