IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

how to capture job name, its return code and send an email


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
GANAPATH

New User


Joined: 06 Mar 2006
Posts: 35

PostPosted: Wed May 31, 2006 1:18 am
Reply with quote

Hi,

i submit lots of jobs everyday, i want to get an email
that consists of jobname and its return code, so that it is easy to see the result in that way. Can i do this through JCL

Thanks,
Ganapath
Back to top
View user's profile Send private message
rajandhla

Active User


Joined: 18 Oct 2005
Posts: 182
Location: Luton UK

PostPosted: Wed May 31, 2006 2:16 pm
Reply with quote

Yes we can do it...........

Check the utilites that you are using in your shop.......


Regards
jai
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed May 31, 2006 6:18 pm
Reply with quote

GANAPATH wrote:
Can i do this through JCL?


I don't know about doing what you want strictly with JCL, as you need to access the job's JSCB control blocks for that information.

Here is a REXX exec that combines the code of two shareware exec's to provide the information you are looking for. You would run this as the last step of your job(s):

Code:

/* REXX GETRC                                     */     
/* Find the job step with the highest Return-Code */     
Numeric Digits(32)                                       
Call GETJOB                                             
Call GETRCS                                             
Say 'JOB:'jnam' ID:'jnum                                 
hi_step = ''                                             
hi_rcstep = 0                                           
Do j = 1 To (i-1)                                       
  Say 'STEP:'step.j' RCODE:'rcstep.j                     
  If rcstep.j > hi_rcstep Then                           
    Do                                                   
      hi_step = step.j                                   
      hi_rcstep = rcstep.j                               
    End                                                 
End                                                     
Say 'HIGHEST RC:'hi_step hi_rcstep                       
Exit 0                                                   
                                                           
GETJOB:                                                     
/* Get the Job Name and Job Number                */       
tcb   = PTR(540)                                           
tiot  = PTR(tcb+12)                                         
jnam  = STG(tiot,8)                                         
jscb  = PTR(tcb+180)                                       
ssib  = PTR(jscb+316)                                       
jnum  = STG(ssib+12,8)                                     
Return                                                     
                                                           
PTR: Return C2D(Storage(D2X(Arg(1)),4))                     
STG: Return Storage(D2X(Arg(1)),Arg(2))                     
                                                         
GETRCS:                                                   
/* GET THE STEP NAME AND RETURN CODE INFORMATION */       
tcb  = Storage(D2X(540),4)                               
jscb = Storage(D2X(C2D(tcb)+180),4)                       
jct  = Storage(D2X(C2D(jscb)+261),3)                     
this_step_no = X2D(C2X(Storage(D2X(C2D(jscb)+228),1)))   
fsct = Storage(D2X(C2D(jct)+48),3)                       
temp_sct = fsct                                           
Do i = 1 To (this_step_no - 1)                           
  step.i = Storage(D2X(C2D(temp_sct)+68),8)               
  rcstep.i = X2D(C2X(Storage(D2X(C2D(temp_sct)+24),2)))   
  bypass = Storage(D2X(C2D(temp_sct)+188),1)             
  If X2D(C2X(bypass)) = 80 Then                           
    Do                                                   
      rcstep.i = 'FLUSHED '                               
    End                                                   
  temp_sct = Storage(D2X(C2D(temp_sct)+36),3)             
End                                                       
Return                                                   
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts run rexx code with jcl CLIST & REXX 15
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts VSAM return code 23 - for a Random read COBOL Programming 4
Search our Forums:

Back to Top