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 

Programmatically querying abend and reason codes

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
coder
Beginner


Joined: 08 Jan 2007
Posts: 2
Topics: 1
Location: Chicago, IL

PostPosted: Wed Feb 14, 2007 5:19 pm    Post subject: Programmatically querying abend and reason codes Reply with quote

Does anyone know of a way to programmatically retrieve the abend return code and reason code of a prior job step?

As an example of what I need to do, lets say I have a three steps job running. If any of the first three steps abend or throw an RC, I want to conditionally execute a "logging step" which will be a (C or HLASM, preferably C) program that retrieves the abend information (return and reason codes) and does something with that information (like updating a master log of sorts).

//STEP1 EXEC PGM=STEP1
//STEP2 EXEC PGM=STEP2
//STEP3 EXEC PGM=STEP3
// IF ( ABEND | RC > 0 ) THEN
//LOGSTEP EXEC PGM=LOGSTEP
// ENDIF

Some time ago I was able to do something similar using the SWAREQ macro in an HLASM program, but I believe I was only able to get at the return code, and not the reason code.

Can anyone point me in the right direction? Thanks!
Back to top
View user's profile Send private message
vak255
Intermediate


Joined: 10 Sep 2004
Posts: 384
Topics: 79

PostPosted: Thu Feb 15, 2007 5:12 pm    Post subject: Reply with quote

Coder,
Is this LOGSTEP is your pgm which will create/update the log file. or your asking how to copy the system messages to a file?
Back to top
View user's profile Send private message
coder
Beginner


Joined: 08 Jan 2007
Posts: 2
Topics: 1
Location: Chicago, IL

PostPosted: Thu Feb 15, 2007 6:45 pm    Post subject: Reply with quote

Kiran,

Yes, LOGSTEP is the program I am writing that will be logging information, like the user, jobname, abend information and doing various other things like email notifications to appropriate personnel.
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Fri Feb 16, 2007 5:04 am    Post subject: Reply with quote

If your prior steps wrote their dignostics to file rather than sysout your log program can query those files. You could use parameters to pass in jobname/user info, or - if you are writing your log program in assembler then you could possibly access the relevant control blocks - but that is way beyond me.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri Feb 16, 2007 5:23 am    Post subject: Reply with quote

i suggest going thru the CBT TAPE table of contents at www.cbttape.org. There are a couple of ways to read the jes of a job either after the fact or as part of the job.

do you not have a scheduling system? Most have functions that provide for notification of job problems.

though your solution will effect notification and logging, what i suggest is that you implement in the interm a less intensive method -using the scheduler - proven, debugged system -

(whereas you are writting something which will be introduced to every job - how long are you going to answer calls in the middle of the night until you have worked all the kinks out?)

and attack the problem where it lies - poorly documented, multimethod error handling by programs - and implement a standard communications methodology between jobs/programs and the individual responsible when problems occur.

the cbt tape can provide you something if you don't want to use the scheduler option.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
semigeezer
Supermod


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

PostPosted: Fri Feb 16, 2007 8:59 am    Post subject: Reply with quote

There are also control blocks you can chase, at least for return codes -- not sure about abend and reason codes. Search the board for examples.
Back to top
View user's profile Send private message Visit poster's website
vak255
Intermediate


Joined: 10 Sep 2004
Posts: 384
Topics: 79

PostPosted: Fri Feb 16, 2007 2:58 pm    Post subject: Reply with quote

I think all you have to do is copy from sysout/Abend log. it depends on what you want to copy. I have seen some links where there is a command to copy system messages. try to serach here, or if i come across i willl keep u posted.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming 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