2014年8月8日 星期五

Print running jobs and their elapsed times

/* Rexx - Print running jobs and their elapsed times                 */ 
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 */