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

Recovery Routine/Abend exit to release ENQs during abends


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Siva NKK Kothamasu

New User


Joined: 20 Apr 2017
Posts: 10
Location: South Africa

PostPosted: Tue Feb 25, 2020 4:43 pm
Reply with quote

Good Day,

We have a COBOL program that calls an HLASM program to take ENQ.

Once control is back into COBOL, it will call n number of other COBOL and/or ASM programs and releases the ENQ (by calling the same ASM pgm) before GOBACK.

This is an online program and the issue we have is, if there is an abend in any of the programs that the COBOL program calls, the ENQ is still held by the region causing transaction queue build-ups until the region is cycled.

Can this issue be solved using Recovery Routines (IEAARR) or having an ABEND EXIT is the only solution or are there any better alternatives.

Appreciate your assistance.
Back to top
View user's profile Send private message
Apoorva

New User


Joined: 28 Jan 2020
Posts: 49
Location: India

PostPosted: Tue Feb 25, 2020 5:55 pm
Reply with quote

Yes you could have an ESTAE recovery routine to perform "DEQ" and other clean-ups. Your ASM program, that obtains the ENQ, could establish an ESATE once "ENQ" is successful, and could remove the ESTAE routine once "DEQ" is successful. So, if there are any abends, in between ENQ/DEQ, your ESTAE will get control which could perform the DEQ.
Back to top
View user's profile Send private message
Siva NKK Kothamasu

New User


Joined: 20 Apr 2017
Posts: 10
Location: South Africa

PostPosted: Tue Feb 25, 2020 7:01 pm
Reply with quote

Thank you Apoorva ji.

I will try it and let the forum know the outcome.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Feb 25, 2020 7:03 pm
Reply with quote

Quote:
This is an online program


No alternatives... the abend should be handled at the transaction level using CICS constructs
anything else might clobber all the abend recovery of the CICS address space
Back to top
View user's profile Send private message
Apoorva

New User


Joined: 28 Jan 2020
Posts: 49
Location: India

PostPosted: Tue Feb 25, 2020 7:05 pm
Reply with quote

Siva NKK Kothamasu wrote:
Thank you Apoorva ji.

I will try it and let the forum know the outcome.


You are Welcome Siva!
Back to top
View user's profile Send private message
Siva NKK Kothamasu

New User


Joined: 20 Apr 2017
Posts: 10
Location: South Africa

PostPosted: Wed Feb 26, 2020 6:51 pm
Reply with quote

Quote:
No alternatives... the abend should be handled at the transaction level using CICS constructs
anything else might clobber all the abend recovery of the CICS address space


We are running in an IMS environment.

Also, one more question.

Ex: Program A called Program B and Program B activated the Recovery Routine and passed control back to Program A.

Program A now called Program C.

Will the Recovery Routine be still active during the execution of Program C?

Note: Program B is the one that's activated the Recovery Routine.

Thanks
Siva
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Wed Feb 26, 2020 9:09 pm
Reply with quote

A recovery environment is active until it is discarded.

There are two things confusing about recovery. I just mentioned the first thing. The other thing is there are two parts of a recovery environment.
  • The ESTAE exit routine
    The exit routine receives control early in ABEND. Among other things it has to decide whether it's possible to recover smoothly, and do other things.
  • The recovery retry routine.

Now, to add to the confusion is a fact most beginners are ignorant about, but you have to know about this to understand what you can or cannot do in ABEND recovery. In OS/360 derived systems like z/OS programs running in task mode have to have a TCB, which everyone knows about, but less well know is a program must have a "request block" (RB). We see these RBs in ABEND dumps, but we generally do not understand their significance. As a program executes it can gather a number of these RBs. Two things must be present for a program to run.
  • There must be a TCB that is not blocked for some reason AND
  • The most recently acquired RB for the task must not be in wait. The status of the older RBs is immaterial

Now, when your program ABENDs, the system obtains an RB for ABEND. In order to run the ESTAE exit routine, ABEND creates yet another RB for the exit routine.

The environment you see in an ABEND dump has the RB for your program followed by the RB for ABEND and, finally, the RB created by the SNAP macro which is used to print the dump. In other words, SNAP, like your exit routine, is sort of a subroutine of ABEND. In an OS/360 ABEND dump this was clear. z/OS complicates this picture with a lot of extraneous c****.

Now let's go back to the ESTAE exit. After it does its thing it returns to ABEND. If the exit wants to continue running the program that failed it has to tell ABEND where the "retry" program is. You use the SETRP macro for this or you can alter a control block called the SDWA which ABEND obtains before it enters your exit routine yourself which is what SETRP does. If there is a retry program ABEND alters the request block that failed to go to the retry program and terminates the ABEND request block. At this point the system enters the "retry" routine using the RB that failed.

Now, if I understand what you want to do you use the ESTAE exit to DEQ the resource you want to release and return to ABEND and forget the "retry" routine. All this should work.
Back to top
View user's profile Send private message
Apoorva

New User


Joined: 28 Jan 2020
Posts: 49
Location: India

PostPosted: Wed Feb 26, 2020 10:29 pm
Reply with quote

"Will the Recovery Routine be still active during the execution of Program C?"

Yes Siva recovery routine will be always active until you issue "ESTAE 0" which removes the most recently added recovery routine from the stack.

Suppose if you issue below two ESTAE followed by "ESTAE 0", "RCVY-RTN2" will be removed from the stack,

ESATE RCVY-RTN1
ESTAE RCVY-RTN2
Back to top
View user's profile Send private message
Siva NKK Kothamasu

New User


Joined: 20 Apr 2017
Posts: 10
Location: South Africa

PostPosted: Thu Feb 27, 2020 12:47 pm
Reply with quote

steve-myers wrote:
A recovery environment is active until it is discarded.

There are two things confusing about recovery. I just mentioned the first thing. The other thing is there are two parts of a recovery environment.
  • The ESTAE exit routine
    The exit routine receives control early in ABEND. Among other things it has to decide whether it's possible to recover smoothly, and do other things.
  • The recovery retry routine.

Now, to add to the confusion is a fact most beginners are ignorant about, but you have to know about this to understand what you can or cannot do in ABEND recovery. In OS/360 derived systems like z/OS programs running in task mode have to have a TCB, which everyone knows about, but less well know is a program must have a "request block" (RB). We see these RBs in ABEND dumps, but we generally do not understand their significance. As a program executes it can gather a number of these RBs. Two things must be present for a program to run.
  • There must be a TCB that is not blocked for some reason AND
  • The most recently acquired RB for the task must not be in wait. The status of the older RBs is immaterial

Now, when your program ABENDs, the system obtains an RB for ABEND. In order to run the ESTAE exit routine, ABEND creates yet another RB for the exit routine.

The environment you see in an ABEND dump has the RB for your program followed by the RB for ABEND and, finally, the RB created by the SNAP macro which is used to print the dump. In other words, SNAP, like your exit routine, is sort of a subroutine of ABEND. In an OS/360 ABEND dump this was clear. z/OS complicates this picture with a lot of extraneous c****.

Now let's go back to the ESTAE exit. After it does its thing it returns to ABEND. If the exit wants to continue running the program that failed it has to tell ABEND where the "retry" program is. You use the SETRP macro for this or you can alter a control block called the SDWA which ABEND obtains before it enters your exit routine yourself which is what SETRP does. If there is a retry program ABEND alters the request block that failed to go to the retry program and terminates the ABEND request block. At this point the system enters the "retry" routine using the RB that failed.

Now, if I understand what you want to do you use the ESTAE exit to DEQ the resource you want to release and return to ABEND and forget the "retry" routine. All this should work.


Thanks a lot for the detailed explanation Steve. Will code & test it today and also will post an update on this page. icon_smile.gif
Back to top
View user's profile Send private message
Siva NKK Kothamasu

New User


Joined: 20 Apr 2017
Posts: 10
Location: South Africa

PostPosted: Thu Feb 27, 2020 12:50 pm
Reply with quote

Apoorva wrote:
"Will the Recovery Routine be still active during the execution of Program C?"

Yes Siva recovery routine will be always active until you issue "ESTAE 0" which removes the most recently added recovery routine from the stack.

Suppose if you issue below two ESTAE followed by "ESTAE 0", "RCVY-RTN2" will be removed from the stack,

ESATE RCVY-RTN1
ESTAE RCVY-RTN2


Thank you Apoorva Ji.

I was reading about Recovery Routines in "MVS Programming: Assembler Services Guide" and came across Request Blocks and the availability of Recovery Routines in relation to the Request Blocks. This lead me to post my other question yesterday.
Back to top
View user's profile Send private message
Apoorva

New User


Joined: 28 Jan 2020
Posts: 49
Location: India

PostPosted: Thu Feb 27, 2020 1:39 pm
Reply with quote

You are Welcome Siva!
Back to top
View user's profile Send private message
Siva NKK Kothamasu

New User


Joined: 20 Apr 2017
Posts: 10
Location: South Africa

PostPosted: Mon Mar 16, 2020 6:03 pm
Reply with quote

I have coded the ESTAEX Routine to remove the ENQ and it is working perfect WHEN INVOKED BY OS for an ABEND.

Thank you for your support so far, Greatly appreciated.

However, at our shop, we have a product called HOGAN and if I activate my ESTAEX from any program running under Hogan, my ESTAEX was not being invoked by MVS.

However, even when under Hogan, my ESTAEX was being invoked for a S0C4 and the abend I am forcing using, ILBOABN0.
Back to top
View user's profile Send private message
Apoorva

New User


Joined: 28 Jan 2020
Posts: 49
Location: India

PostPosted: Mon Mar 16, 2020 7:11 pm
Reply with quote

Siva NKK Kothamasu wrote:
I have coded the ESTAEX Routine to remove the ENQ and it is working perfect WHEN INVOKED BY OS for an ABEND.


Siva,

Glad to know that you got it working! However, I don't understand how your recovery routine is not being invoked by MVS but by HOGAN. Do you mean your recovery routine is being invoked due to an abend in HOGAN program/module? I did a Google search on HOGAN, and looks like it's a core banking software (Please correct me if I am wrong), and hence it would probably not take system related actions like intercepting abends/RTM2, and giving control to ESTAE etc.
Back to top
View user's profile Send private message
Siva NKK Kothamasu

New User


Joined: 20 Apr 2017
Posts: 10
Location: South Africa

PostPosted: Thu Mar 19, 2020 8:15 pm
Reply with quote

Apoorva wrote:
Siva NKK Kothamasu wrote:
I have coded the ESTAEX Routine to remove the ENQ and it is working perfect WHEN INVOKED BY OS for an ABEND.


Siva,

Glad to know that you got it working! However, I don't understand how your recovery routine is not being invoked by MVS but by HOGAN. Do you mean your recovery routine is being invoked due to an abend in HOGAN program/module? I did a Google search on HOGAN, and looks like it's a core banking software (Please correct me if I am wrong), and hence it would probably not take system related actions like intercepting abends/RTM2, and giving control to ESTAE etc.


Hi Apoorva Ji

For COBOL programs written under Hogan frame work, MVS invokes Hogan program/s (probably ASM) during an ABEND.

In my case, the COBOL program from which I am activating my ESTAEX was written using Hogan frame work.

Now, Once my ESTAEX was activated and if the abend in the transaction is due to SOC4/S0C7/ILBOABN0 etc, my ESTAEX was being invoked and it is doing it's job.

However, If I use any Hogan provided routines (usually called Activities) to cause an abend, my ESTAEX was not being invoked.

I am planning to speak to the Hogan admins in our company to see if they know the reason.

Anyways, Thanks again for your assistance.

I am new to ASM and this is the 1st time for me to write ESTAEX routines.

Your help (Apoorva & Steve) is greatly appreciated and you already answered the question in Subject. :-)
Back to top
View user's profile Send private message
Apoorva

New User


Joined: 28 Jan 2020
Posts: 49
Location: India

PostPosted: Thu Mar 19, 2020 8:53 pm
Reply with quote

Thanks for the update Siva! Looks like you already have a plan, and I am sure you will get it resolved.

[/quote]

I am new to ASM and this is the 1st time for me to write ESTAEX routines.

[/quote]

Good start Siva!
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 -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts ISAM and abend S03B JCL & VSAM 10
No new posts Use of Perform Thru Exit COBOL Programming 6
No new posts user exit in IBM Infosphere Optim DB2 8
No new posts Abend S0C4 11 (Page Translation Excep... PL/I & Assembler 16
No new posts Batch call online program, EXCI task ... CICS 3
Search our Forums:

Back to Top