MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Code a REXX to find out number of Jobs in Input Queue !!

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
amit4u79
Beginner


Joined: 24 Oct 2005
Posts: 109
Topics: 36
Location: India

PostPosted: Tue Mar 21, 2006 12:15 am    Post subject: Code a REXX to find out number of Jobs in Input Queue !! Reply with quote

Hi Everyone,

Is there anyway we can code a REXX to chase the MVS Control Blocks and find out if any of the batch job is in the Input Queue for more than the specified amount of time.

Previously, I had the requirement to find out the jobs running for more than a specified amount of time, and I had got an excellent REXX using the MVS Control Blocks.

Kindly help.

Regards,
- Amit.
_________________
I did not fail; I have found 10,000 ways that would not work - Albert Einstein.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Bill Dennis
Advanced


Joined: 03 Dec 2002
Posts: 579
Topics: 1
Location: Iowa, USA

PostPosted: Tue Mar 21, 2006 3:18 pm    Post subject: Reply with quote

You could do batch SDSF display of the Input Queues, write it to a temp dataset and use REXX (or other utility) to summarize based on RDR-DATE and RDR-TIME columns (assuming you can display those columns).

Code:
//* DISPLAY INPUT QUEUES
//GET1     EXEC PGM=SDSF,PARM='++120,140'  LENGTH=120, WIDTH=140
//ISFOUT   DD  SYSOUT=*                                         
//ISFIN    DD  DSN=&&SCREEN,     <pass to utility step>
//   DISP=(,PASS),SPACE=..
//SYSIN   DD *
I                                                         

_________________
Regards,
Bill Dennis

Disclaimer: My comments on this foorum are my own and do not represent the opinions or suggestions of any other person or business entity.
Back to top
View user's profile Send private message
amit4u79
Beginner


Joined: 24 Oct 2005
Posts: 109
Topics: 36
Location: India

PostPosted: Tue Mar 21, 2006 9:31 pm    Post subject: Reply with quote

Hi Bill,

Thanks for your suggestion, but we were wondering if this could be done through REXX getting information grabbed from some MVS control block, it would be preferred. For example a couple of months back when I wanted to find out the Elapsed time of batch jobs I was presented with a REXX code as below:
Code:

Numeric digits 20                                                     
cvt=ptr(16)                            /* Get CVT                    */
asvt=ptr(cvt+556)+512                  /* Get asvt                   */
rmct=ptr(cvt+x2d('25c'))                                               
asvtmaxu=ptr(asvt+4)                   /* Get max asvt entries       */
Do a = 0 to asvtmaxu - 1                                               
  ascb=stg(asvt+16+a*4,4)              /* Get ptr to ascb (Skip       
                                          master)                    */
  If bitand(ascb,'80000000'x) = '00000000'x Then /* If in use        */
    Do                                                                 
      ascb=c2d(ascb)                   /* Get ascb address           */
      cscb=ptr(ascb+56)                /* Get CSCB address           */
      chtrkid=stg(cscb+28,1)           /* Check addr space type      */
      ascbjbni=ptr(ascb+172)           /* Get ascbjbni               */
      If chtrkid='03'x & ascbjbni<>0 Then                             
        Do                                                             
          oucbomvs = bitand(stg(37+ptr(ascb+144,4),1),'10'x)           
          if oucbomvs ='00'x then                                     
            do                                                         
              ascbints = stg(ascb+304,4) /* job selection time       */
              rmcttoc = stg(rmct+128,4) /* rmf current time          */
              delta=((c2d(rmcttoc)-c2d(ascbints))*1.048576)%1 /* secs*/
              hh=delta %3600                    /* Get # of hours    */
              mm=right((delta//3600)%60,2,'0')  /* get # of minutes  */
              ss=right((delta//3600)//60,2,'0') /* get # of seconds  */
              Say stg(ascbjbni,8) delta 'sec ('hh':'mm':'ss')'         
            end                                                       
        End                                                           
    End                                                               
End                                                                   
Return                                                                 
/*-------------------------------------------------------------------*/
ptr:  Return c2d(storage(d2x(Arg(1)),4))     /* Return a pointer */   
/*-------------------------------------------------------------------*/
stg:  Return storage(d2x(Arg(1)),Arg(2))     /* Return storage */     

The above code will list out jobs with elapsed time greater than 2 hours and display the job names.

I was just wondering if any of the MVS control blocks held the information of jobs currently in the input queue, we can just have a small tweak in the above rexx and use it instead.

Regards,
- Amit.
_________________
I did not fail; I have found 10,000 ways that would not work - Albert Einstein.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Wed Mar 22, 2006 2:17 am    Post subject: Reply with quote

I suspect that that information is held in another address space's storage (JES). I don't know how to get to it by chasing control blocks. Using SDSF is probably the best way to get the information. I tried Bill's code online instead of batch and it works fine. You just need to post-process the output. (alloc isfin and isfout to your TSO session and start SDSF. This will give you the idea...
Code:
alloc f(isfin)  da(*) reuse shr /* eventually use a data set
alloc f(isfout) da(*) reuse shr /* eventually use a data set
call *(sdsf)             
      ... post-process the output     
Back to top
View user's profile Send private message Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Mar 22, 2006 5:45 am    Post subject: Reply with quote

Quote:

Thanks for your suggestion, but we were wondering if this could be done through REXX getting information grabbed from some MVS control block, it would be preferred



I still do not understand why you need the long route of chasing the control blocks to get the simple information. The batch mode of SDSF can give you the desired results and easy to maintain.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
amit4u79
Beginner


Joined: 24 Oct 2005
Posts: 109
Topics: 36
Location: India

PostPosted: Wed Mar 22, 2006 11:17 pm    Post subject: Reply with quote

Hi Kolusu,Semigeezer,

I know using SDSF in batch would be easy to maintain, but we have this understanding that getting information through Control Block the execution time is less and the CPU utilisation is also comparatively small.

If my understanding is incorrect, kindly let me know so that I can implement the batch SDSF solution. But one thing is when I used batch SDSF using the ISFIN as 'I', it does not display anything like RDR-DATE and RDR-TIME, so was just wondering what information that has and why am I not able to see it in my ISFOUT to SYSOUT ??

Kindly respond.

Regards,
- Amit.
_________________
I did not fail; I have found 10,000 ways that would not work - Albert Einstein.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Thu Mar 23, 2006 1:17 am    Post subject: Reply with quote

If you were chasing control blocks in Assembler or Cobol that would definitely be true, but using Rexx, you are invoking the overhead of an intereter, massive data conversions, error checking (bounds, datatypes, syntax, etc) and all sorts of overhead. While you have the same problem reading SDSF output with Rexx, I doubt that the overhead of calling SDSF and an EXECIO will be much greater than chasing complex control blocks. But as I said before, I don't think the job queues are in user readable storage. I think you need to use the JES subsystem interfaces to query that information. Even if they were, that information probably changes ofteh enough that you would run the risk of chains changing while your rexx is running.
Back to top
View user's profile Send private message Visit poster's website
amit4u79
Beginner


Joined: 24 Oct 2005
Posts: 109
Topics: 36
Location: India

PostPosted: Thu Mar 23, 2006 2:26 am    Post subject: Reply with quote

Hey Semigeezer,

Thanks for your suggestions and making me understand the fact.

Regards,
- Amit.
_________________
I did not fail; I have found 10,000 ways that would not work - Albert Einstein.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group