Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

Exception Handling

SOLVED
Go to solution
Steve Lobsinger
Occasional Visitor

Exception Handling

Hi -

I'm working with an openVMS Alpha system (6.2, I think) and have a situation where a C program calls a Fortran subroutine. Inside the fortran procedure, the LIB$ESTABLISH call is made to handle exceptions.

My question is this: Assume an exception occurs in the Fortran subroutine. Control will then pass to the specified exception handler to do it's work. Once the exception handler has completed, where does control return to? Does it go back to the next line in the fortran subroutine? Does it return to the calling C routine?

Thanks in advance!!

-steve
4 REPLIES
Travis Craig
Frequent Advisor
Solution

Re: Exception Handling

Steve,

I think you can do it either way. This link discusses it some:

http://h71000.www7.hp.com/doc/731FINAL/5841/5841pro_032.html

I think if your condition handler returns SS$_CONTINUE then it will return to the Fortran routine, either the line that caused the problem or the next one, depending on what it is.

Returning to the C program looks complicated in that description, but I think you can also use LIB$SIG_TO_RET to make it simple.

It's been many years since I've done this, but I hope these pointers help.

--Travis
My head is cold.
Kris Clippeleyr
Honored Contributor

Re: Exception Handling

Steve,

Where the condition handler returns to after dealing with the error, is entirely up to the way the condition handler is written. It can return to the statement following the one that caused the excption, it can return to the "caller of the establisher", or even unwind more call frames and return to somewhere else in the program. I think you have to have a thorough look at the handler.

Regards,
Kris (aka Qkcl)
I'm gonna hit the highway like a battering ram on a silver-black phantom bike...
Steve Lobsinger
Occasional Visitor

Re: Exception Handling

Travis -

Thanks for the info and the link. I think from the information you gave I can get where I need to go.

Thanks!
-steve
Steve Lobsinger
Occasional Visitor

Re: Exception Handling

Kris -

You are right about needing to know what the condition handler is doing...and that's what I've got to write!

I should be able to figure out how to get it to return control to where I want upon return...I hope. If not I'm sure you guys will hear from me again!

Thanks for the great replies!

-steve