Control blocks - retrieve start time of an active job



IBM's Command List programming language & Restructured Extended Executor

Control blocks - retrieve start time of an active job

Postby dohara » Wed Jul 29, 2009 2:22 am

Hello

I need to run certain checks on active jobs and i'm unable to retrieve the time when the job in question started running.
The only idea was to get this info from the control blocks but found no manual that describes the structure of the different control blocks
and so i can not setup the pointer and storage area and so on...

I found some examples as to how to retrieve jobname but what i need is the time...:

/* Rexx */
/* --- Get Address of ASCB ----------------------- */
ASCB_Addr = C2D(Storage(224,4)) /* Get address of ASCB */

/* --- First check ASCBJBNI for Jobname ------------------- */
Interpret "JobAddr = Storage("D2X(ASCB_ADDR+172)",4)"

If C2D(JobAddr) = 0 Then
/* --- Not in initiator, so get jobname from ASCBJBNS -- */
Interpret "JobAddr = Storage("D2X(ASCB_ADDR+176)",4)"

Interpret "Job = Storage("C2X(JobAddr)",8)"
say "Jobname: " Job
exit

Or

/* REXX Get taskname from TCB */
cvt = storage(10,4) /* FLCCVT-PSA data area */
tcbp = storage(d2x(c2d(cvt)),4) /* CVTTCBP */
tcb = storage(d2x(c2d(tcbp)+4),4)
tiot = storage(d2x(c2d(tcb)+12),4) /* TCBTIO */
say storage(d2x(c2d(tiot)),580) /* TIOCNJOB */


i somehow should loop throuhg all the active jobs and find out when they each was started.
If i'm not on track at all, any other idea is welcome.

Thanks,
David
dohara
 
Posts: 42
Joined: Thu Apr 09, 2009 3:15 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Control blocks - retrieve start time of an active job

Postby dick scherrer » Wed Jul 29, 2009 8:41 am

Hello,

I suspect you will need a copy of the MVS Data Areas:
http://publibz.boulder.ibm.com/cgi-bin/ ... 0/CONTENTS

The job and step start times are in the JCT (look at the jct map):
http://publibz.boulder.ibm.com/cgi-bin/ ... d380/110.1
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Control blocks - retrieve start time of an active job

Postby expat » Wed Jul 29, 2009 11:27 am

Or you could use SMF data without adding an overhead to all of the jobs that you wish to monitor.
expat
 
Posts: 459
Joined: Sat Jun 09, 2007 3:21 pm
Has thanked: 0 time
Been thanked: 8 times

Re: Control blocks - retrieve start time of an active job

Postby dick scherrer » Wed Jul 29, 2009 11:01 pm

Hi Expat,

Possibly, i misunderstood. . .

Thought the idea was to issue a periodic "snapshot" of currently running jobs?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Control blocks - retrieve start time of an active job

Postby expat » Thu Jul 30, 2009 11:35 am

Hi Dick,

Yip, you are correct.
expat
 
Posts: 459
Joined: Sat Jun 09, 2007 3:21 pm
Has thanked: 0 time
Been thanked: 8 times

Re: Control blocks - retrieve start time of an active job

Postby dohara » Tue Aug 04, 2009 4:10 am

Hi Dick and Expat,

Thanks for your reply

I started looking into the control blocks but it looks slightly complicated to me.
what i've found out so far is that JCT and JCTX contain time and date of jobs
and JCT can be accessed from JSCB according to the documentation:

JCT
Pointed to by: - JSCBJCTA field (SVA) of the JSCB data area
- SWBUFPTR field in IEFZB506 upon return from IEFQMREQ
macro (Preferred method of SVA translation)
- SWBLKPTR field in IEFZB505 upon return from SWAREQ
macro


JSCB
Pointed to by: TCBJSCB field of data area TCB
JSCBACT field of data area JSCB (active JSCB)


Offset 261 in JSCB points to JCT as seen below:
261 (105) CHARACTER 3 JSCBJCTA - SVA of JCT, use
SWAREQ to convert to
a pointer


JSCB is pointed to by TCB - offset 180
180 (B4) ADDRESS 4 TCBJSCB - ADDRESS OF THE JOB
(0) STEP CONTROL BLOCK


TCB is pointed to by many different fileds of different data areas, i checked CVT
offset 373 - CVTSLIDA field of the CVT data area (supervisor lock TCB)
offset 888 - CVTWTCB field of the CVT data area (dummy WAIT TCB)


And CVT is pointed to by PSA
FLCCVT field of the PSA data area (location X'10')
FLCCVT2 field of the PSA data area

Offset in PSA to CVT is : 16 (10) ADDRESS 4 FLCCVT "V(IEACVT)" - ADDRESS
OF CVT (AFTER IPL).
THIS OFFSET FIXED BY
ARCHITECTURE.
(MDC450)


So to access JCT the order is something similar:
PSA - CVT - TCB - JSCB - JCT

Reading up description for JCT, the following can be seen: Frequency: One per job
Then are there as many JCT as many jobs are running on the system ?
In JSCB i don't see any reference to the number of JCTs and so far i was only able to
retrieve information from my own job.

Please give me some more guidance
Thanks in advance,
David

Sorry about it being that long list above, that is mostly a summary for myself to see what i've found out so far.
dohara
 
Posts: 42
Joined: Thu Apr 09, 2009 3:15 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Control blocks - retrieve start time of an active job

Postby expat » Tue Aug 04, 2009 11:54 am

and so far i was only able to retrieve information from my own job.

That sounds about right, as you can only access the control blocks within the current address space. Well you could try to access others but certainly not something that I would even consider attempting.

So it would seem that whatever code you get to work to retrieve the information from one job will need to be implemented into each and every job that you want to monitor / report on.

I don't suppose that you have considered using SDSF via REXX as an easier solution :mrgreen:
expat
 
Posts: 459
Joined: Sat Jun 09, 2007 3:21 pm
Has thanked: 0 time
Been thanked: 8 times

Re: Control blocks - retrieve start time of an active job

Postby dohara » Tue Aug 04, 2009 12:51 pm

Hello Expat,

Well, i have :)
Actually the current code i run is an easy one, issuing /D J,A and capturing the result
It lists all the tasks running on the system and i only need to filter out Jobs and the elapsed time
It is working fine but i thought there was a way to collect the same info from the control blocks
At least now i'm having a bit more understanding on using them

To access SDSF and capture the info i need, i use ISFCALLS
I also tried to get the active jobs from DA OJOB but did not succeed as i was unable to access it, only ST but that lists not only the active jobs,
even if i sort by queue, there are multipe jobs in execution status waiting for the active one to go and then they jump in.

Is there a way to capture jobs in DA OJOB or access SDSF, any other way you can think of ?
I'm interested in different solutions

Thanks,
David
dohara
 
Posts: 42
Joined: Thu Apr 09, 2009 3:15 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Control blocks - retrieve start time of an active job

Postby dick scherrer » Wed Aug 05, 2009 2:17 am

Hello,

In the beginning. . . .
I need to run certain checks on active jobs
Which checks do you want to implement?

If we had a better idea of just what the goal is, we might be able to offer better suggestions.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Control blocks - retrieve start time of an active job

Postby dohara » Mon Aug 10, 2009 12:02 am

Hello,

As i wrote in the first entry i have to perform certain checks on active jobs. I did not detail the ones i'd managed to perform. the only check i was strugglig with was to retrieve the elapsed time from each active job to see how long they each has been running. The initial idea was to retrieve this information from MVS control blocks but as it turned out it is not the best way. Already managed to find a way around by issuing a simple mvs cmd and parsing the result.

Sorry if i failed to make myself clear and thanks for your help.
David.
dohara
 
Posts: 42
Joined: Thu Apr 09, 2009 3:15 pm
Has thanked: 0 time
Been thanked: 1 time

Next

Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post