Find the value of LAST-RUN DATE/TIME of LJOB command through SQL in CA 7
search cancel

Find the value of LAST-RUN DATE/TIME of LJOB command through SQL in CA 7

book

Article ID: 228056

calendar_today

Updated On:

Products

CA 7 Workload Automation

Issue/Introduction

The output from LJOB,JOB=jobname will contain a lot of information about the specified job. You will also see the LAST-RUN DATE/TIME for all jobs. 

LJOB,JOB=TESTJOB                                                                
JOB=TESTJOB                                            DATE=21.314    PAGE 0001
                                                                               
  JOB    ----JCL----   SYSTEM  USR MAIN PROSE  SCHED  --NUMBER OF-   LAST-RUN  
  NAME    ID  MEMBER   -NAME-  -ID -ID- DSNBR    STP DDS   RUNS           DATE/TIME 
                                                                               
TESTJOB  000 TESTJOB   TEST     010 ALL  000049  YES   004 000 8390  21231/1019 

Resolution

You can use the following JCL and SQL control cards to find the jobs last run time from the LJOB command:

 //STEP1 EXEC PGM=DBSQLPR                                  
 //STEPLIB  DD  DISP=SHR,DSN=your.datacom.CUSLIB 
 //                 DD  DISP=SHR,DSN=your.datacom.CAAXLOAD
 //SYSPRINT DD SYSOUT=*                                    
 //STDOUT DD SYSOUT=*                                      
 //OPTIONS DD *                                            
 PRTWIDTH=255                                              
 INPUTWIDTH=70                                             
 ROWLIMIT=5000                                             
 AUTHID=MFWA                                               
 NOTYPE                                                    
 //SYSIN DD *
SELECT JOB, START_TIME FROM CA7_JOB 
WHERE   DB = 'your_logical_database' ;